[GeoMoose-users] Results Templates - Format Dates
Christopher Hughes
chughes at co.lincoln.or.us
Wed Oct 7 16:09:31 PDT 2026
Thanks I'll do some testing
--
Chris Hughes
GIS Analyst
Lincoln County GIS Department
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
________________________________
From: Dan Little <theduckylittle at gmail.com>
Sent: Wednesday, October 7, 2026 1:53 PM
To: Christopher Hughes <chughes at co.lincoln.or.us>
Cc: Espoir SINS via GeoMoose-users <geomoose-users at lists.osgeo.org>
Subject: Re: [GeoMoose-users] Results Templates - Format Dates
While not a totally perfect solution, Javascript's lack of types can be kinda valuable here:
function normalizeDate(value) {
const d = new Date(value); // this will do a best guess
return (new Intl.DateTimeFormat().format(d)); // this will use the user's locale to format the date
}
That could be used in a pipe to format arbitrary date values. A little duck-typing/data checking could make it a lot safer.
On Wed, Oct 7, 2026 at 12:56 PM Christopher Hughes via GeoMoose-users <geomoose-users at lists.osgeo.org<mailto:geomoose-users at lists.osgeo.org>> wrote:
Hello everyone,
I was curious if anyone has had success altering date formats specifically in GeoMoose's template results. I've had some success adjusting the results using the pipes found at adammark/Markup.js: Powerful JavaScript templates<https://github.com/adammark/Markup.js/> (i.e. converting results to uppercase/lowercase, adjusting the default null value, replacing one string with another). It does give some examples of how to format dates, but I wasn't sure how to implement that in GeoMoose's deployment of MarkUp.
The issue is I'm trying to connect to a rest service (so I don't have control of the data at the source). It has a few fields that come through as YYYY-MM-DDTHH:MM:SS-[whatever the UTC modifier is] (which works but is a bit ugly), and a couple that come through as the number of seconds since 1970 (which is less useful for the average person).
Chris
--
Chris Hughes
GIS Analyst
Lincoln County GIS Department
880 NE 7th St<https://www.google.com/maps/search/880+NE+7th+St?entry=gmail&source=g>. l Newport, OR 97365
Tel: (541) 574 1283<tel:(541)%20574-1283>
_______________________________________________
GeoMoose-users mailing list
GeoMoose-users at lists.osgeo.org<mailto:GeoMoose-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/geomoose-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20261007/87bc87df/attachment-0001.htm>
More information about the GeoMoose-users
mailing list