-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use timezone-aware ISO 8601 for website timestamp #13347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1b6f6d9 to
00b2173
Compare
|
@drammock is there anything else you want me to do? The code is not using jQuery anymore. |
|
sorry for the slow review. IIUC, what you're doing here is to hard-code the datetime style that you prefer, so that everyone sees that. To me that seems like a step backwards: the status quo is that date formatting follows the user's language setting. As far as I can tell, it is standard on the web to use language (not other aspects of the system locale) to determine date/time formatting (because in long forms, weekdays and months are spelled out as words, and in numeric forms some languages don't use arabic numerals). However, if you check your browser's console for console.log(navigator.language);
console.log(Intl.DateTimeFormat().resolvedOptions().locale);and they return different values, then I'm OK with passing the second of those to |
|
Let's try if this works. The current behavior is actually a step backwards, because it doesn't follow my locale settings. I do use an As a sidenote, ISO 8601 is not just some random format that I happen to prefer, that's the standardized format that I would use for consistency. |
|
This doesn't work, not sure why, but I still get the US format. |
I am surprised. If I open my browser console and run: const d = new Date("2025-08-14T18:27:46.531773+00:00");
d.toLocaleString('en-US');
// "8/14/2025, 1:27:46 PM"
d.toLocaleString(['en-AT', 'en-GB']);
// "14/08/2025, 13:27:46"then I get clearly different results for
Prior to the purge of JQuery, it didn't follow your settings either. The datetime was starting out in ISO 8601 and then failing to localize, meaning everyone saw the same thing. In this PR, ec2d8e9 was returning us to that state --- where everyone sees the same thing. Localization that follows the user-set language (which seems to be what much javascript out there does) is better than that (in terms of the % of users who will see something that they like / can more readily interpret). Localization that follows the user-set datetime locale is even better, which is why I suggested it as a solution to your case (where the language and time locales differ).
Please don't act as if I don't know what ISO 8601 is. It's insulting.
If what you want is to use the standard (and force everyone to see that format) then why are you even mentioning your locale settings in the first place? Please clarify what you actually want: following your time locale, or always seeing the ISO 8601 form? What I want is for users to see a localized version, according to their browser/system settings, with time zone. In 72be2bf we've lost the time zone, so I was wrong to say "purge all the options and just pass the locale" (paraphrasing); I'd like us to pass |
|
Was my initial explanation not clear? |
fair point; re-reading it you do clearly request to use (timezone-amended) ISO 6801. However, I still would like to know whether knowing now that localization was intended behavior that some users wanted, are you still requesting to force ISO 6801 on all users, or would you be content with localization that actually respected your settings? |
|
I'd prefer consistent timezone-aware ISO for everyone. But if you don't like that, then at least the localized time string should follow my settings. And I did not mean to be disrespectful, I read your comment as saying that I just want to enforce my locale settings on everyone. |
|
I'm going to be offline for the next three weeks, so let's continue the discussion then! |
|
Here's a quick summary:
Therefore, I suggest reverting the timestamps to ISO 8601. However, instead of always showing UTC (e.g., "Last updated 2025-08-16 04:20 UTC"), I thought we could at least show the timestamp in the user's timezone (e.g., "Last updated 2025-08-16 06:20 UTC+2"). |
|
OK, the footer looks like this for me now (see here): © Copyright 2012–2025, MNE Developers. Last updated 2025-10-08 11:42 UTC+02:00. |
|
@drammock let me know if this works for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, after way too much time testing in a macOS VM with different browsers, I've convinced myself that there's really no way to get it to do what it was meant to be doing and still give @cbrnr a good result. As long as your browser's default/preferred language is en-US then you'll see a US-style datetime string from .toLocaleString() (regardless of any OS locale settings).
So I think the remaining decent options are:
date.toISOString(); // 2020-05-12T23:50:21.817Z
date.toUTCString(); // Tue, 12 May 2020 23:50:21 GMT
// pass in a hard-coded locale that is the same for everyone
date.toLocaleString("SE", { "timeZoneName": "short" }); // "2020-05-12 18:50:21 UTC−5"IIRC the whole point of @larsoner's attempt to localize the datetime string was to get it in each dev's own timezone, making it easier to see "these docs were built last night" vs "these docs were built an hour ago" without needing to do mental time zone math. So I think that leads us to the hard-coded locale after all.
I acknowledge that I objected to this before, as imposing one person's format preferences on everyone. I still kinda feel that way, but in the end pragmatism wins because I think that (1) most people understand YYYY-MM-DD HH:mm:ss ZZZ even if it's not the default for their language, and (2) probably not that many people care about this anyway (only contributors) so forcing @cbrnr to either change his browser language or live with an unappealing en-US datetime format seems capricious.
|
Thanks @drammock! It's not that this is super important, but forcing me to interpret AM/PM time is indeed not ideal (is noon AM or PM?) 😄. BTW, why did you go for I think you need to pass the two-part full locale in order for this to work. Previously I used This shows timezone names instead of offsets, but I like it. If you want UTC offset, I think we need to manually set the fields like I previously did. |
That's not what I was seeing (as evidenced by the comment on the last line of my most recent code snippet). sv-SE is fine if that gives better results |
|
I think the full locale (i.e., |
Co-authored-by: Daniel McCloy <dan@mccloy.info>
ead151a to
7f43d30
Compare
|
Does anyone know why these four jobs fail when installing the minimal commands? |
|
likely a download error (from OSF), may be fixed by #13440 |
* upstream/main: MAINT: Auth [skip azp] [skip actions] MAINT: Deploy [circle deploy] [skip azp] [skip actions] Bump github/codeql-action from 3 to 4 in the actions group (mne-tools#13442) ENH: Dont constrain fiducial clicks to mesh vertices (mne-tools#13445) Use timezone-aware ISO 8601 for website timestamp (mne-tools#13347) [pre-commit.ci] pre-commit autoupdate (mne-tools#13443) FIX: Update osf.io links to new format (mne-tools#13440)
* upstream/main: (46 commits) MAINT: Restore edfio git install (mne-tools#13421) Support preload=False for the new EEGLAB single .set format (mne-tools#13096) [pre-commit.ci] pre-commit autoupdate (mne-tools#13453) MAINT: Restore PySide6 6.10.0 testing (mne-tools#13446) MAINT: Auth [skip azp] [skip actions] MAINT: Deploy [circle deploy] [skip azp] [skip actions] Bump github/codeql-action from 3 to 4 in the actions group (mne-tools#13442) ENH: Dont constrain fiducial clicks to mesh vertices (mne-tools#13445) Use timezone-aware ISO 8601 for website timestamp (mne-tools#13347) [pre-commit.ci] pre-commit autoupdate (mne-tools#13443) FIX: Update osf.io links to new format (mne-tools#13440) MAINT: Ensure full checkout is used (mne-tools#13439) Add BDF export (mne-tools#13435) [pre-commit.ci] pre-commit autoupdate (mne-tools#13434) [pre-commit.ci] pre-commit autoupdate (mne-tools#13431) MAINT: Update code credit (mne-tools#13432) FIX, TST: Try to get test_export_epochs_eeeglab passing again (mne-tools#13428) FIX: Add on_few_samples parameter to core rank estimation (mne-tools#13350) MAINT: Reenable mpl nightly (mne-tools#13426) [pre-commit.ci] pre-commit autoupdate (mne-tools#13427) ...
* upstream/main: (23 commits) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) [MAINT] Automatic SPEC0 dependency version management (mne-tools#13451) FIX: Read Nihon Kohden annotation file accurately (mne-tools#13251) MAINT: Restore edfio git install (mne-tools#13421) Support preload=False for the new EEGLAB single .set format (mne-tools#13096) [pre-commit.ci] pre-commit autoupdate (mne-tools#13453) MAINT: Restore PySide6 6.10.0 testing (mne-tools#13446) MAINT: Auth [skip azp] [skip actions] MAINT: Deploy [circle deploy] [skip azp] [skip actions] Bump github/codeql-action from 3 to 4 in the actions group (mne-tools#13442) ENH: Dont constrain fiducial clicks to mesh vertices (mne-tools#13445) Use timezone-aware ISO 8601 for website timestamp (mne-tools#13347) [pre-commit.ci] pre-commit autoupdate (mne-tools#13443) ...
I have set the language to English (US) and the region to Austria on my MacBook, but at least Chrome seems to ignore the locale settings and only uses the language to format the datetime. This means that despite of my locale settings, the timestamp is formatted as follows:
Jul 22, 2025, 10:55:44 PM GMT+2
This is the wrong date order, and it also does not use 24 hour time (despite my settings). I think it would be better to revert to the previous ISO 8601 based timestamp, with the difference that I now include the local timezone (instead of UTC).