Date localisation

What methods do we have to localise date outputs?

The date added and date modified fields are UTC, which is excellent, but being 13hrs ahead of UTC means that the date is extremely misleading. It tends to split during my lunch time, so I have morning = yesterday and afternoon = today.

What I want to achieve in my display template is a Local Time. I’m wondering how I achieve the date math needed to display that?

My experience (doing a little bit of testing) is that both date added and date modified fields are saved in local times, with a notation of the time offset, relative to the UTC. When I format these fields, they show the times in the same time zone. I did find a formatting bug that was preventing the time from being show for these dates, when a formatting string was being used in a display template, and I’ve coded a fix for this that will be included in the next release. But I can’t replicate the issue you are experiencing. Is your Mac set to a different time zone than the time zone you wish to see displayed?

What I’m seeing IS a local time.

The fact that it had a UTC time offset is what made me think it was UTC.

That’s cool, now I know what I’ve got.

1 Like