Insert date/time tool, \T\Z is zz

editor window
open calendar tool using button above
Advanced Mode

instructions say to use \T\Z to display the time zone

here’s what actually happens:

LLLL \T\Z gives you:

Tuesday, August 25, 1987 2:00 AM TZ

LLLL TZ gives you:

Tuesday, August 25, 1987 2:00 AM T+00:00

LLLL ZZ gives you:

Tuesday, August 25, 1987 2:00 AM +0000

LLLL zz gives you what the text implied you were trying to do:

Tuesday, August 25, 1987 2:00 AM Coordinated Universal Time

(which I figured out by clicking the help icon and scrolling through a complex nerd document not meant for typical end users, don’t get me wrong, I love nerd documents!)

I don’t know if there’s a bug or if it’s just a clarity in the text thing. But as an end user, telling me about zz on the calendar screen would have been super useful.

2 Likes

z and zz seem to be deprecated, work only if a timezone is specified (so here it should work :thinking:) . But you are right, \T\Z seems a typo, not sure why the \ and maybe a space between T and Z or no T?

if I understand correctly, the date is always displayed according to the timezone of the user setting
https://your.domain/u/my/preferences/profile
hovering shows the timezones of the system
https://your.domain/admin/site_settings/category/all_results?filter=timezone

1 Like

Any thoughts on this one @joffreyjaffeux?

1 Like

Hmmm I would have sworn I had removed the TZ from the description, it’s indeed not supported anymore, will clarify this tomorrow.

2 Likes

So I made this change which is very simple:

https://github.com/discourse/discourse/commit/c792f369668f418f99ded583fbfc72951525ccf3

Let me explain you more in details what are the reasons for what you had before. It’s true that zz and Z are similar to what you want to achieve, but TZ was a special token I added which would allow to show the timezone using a city name, which I think is clearer for some users not well versed in timezones.

The format was \T\Z and not TZ because it’s a special token and needed to be escaped so moment doesn’t try to replace the Z (this is what you see in your second example where you do LLLL TZ and you end up with T+01:00).

I decided few months ago to remove this to avoid having to support non standard things, but I guess I missed this occurrence as it was escaped two times in locale file: \\T\\Z which I probably fail to grep using single escaped query.

And finally, zz and Z are not deprecated, they have been removed from core moment, but are still very present in moment-timezone, so you can use them safely :+1:

5 Likes

I can’t seem to make format work :anguished:

[date=2020-08-26 time=18:05:00 format="zz" timezone="Europe/Paris"]
Coordinated Universal Time
[date=2020-08-26 time=18:05:00 format="LLLL" timezone="Europe/Paris"]
Wednesday, August 26, 2020 4:05 PM

and as I was testing it with french locale, the format quotation mark has the same problem than the timezone one (so probably in german too).

Zones don’t work in calendar mode (as it’s obvious it’s your timezone) which is yesterday, today and tomorrow.

Friday, September 25, 2020 10:00 PM +00:00 (Coordinated Universal Time)

[date=2020-09-26 timezone="Europe/Paris" format="LLLL Z (zz)"]

You can deactivate it:

Tuesday, August 25, 2020 10:00 PM +00:00 (Coordinated Universal Time)

[date=2020-08-26 timezone="Europe/Paris" format="LLLL Z (zz)" calendar="false"]

3 Likes

And here I am on try.discourse :sweat_smile:

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.