Short Date Format changed to M/D/YYYY format when local OS is D/M/YYYY, and also introduced "u200E" character
I recently updated to Notepad3 (x64) v5.20.915.1 and found the ctrl+F5 short date insert changed in the two ways mentioned above. Like any sensible country, my date format has the month in the middle. It seems a recent code changes looks at the Language en-US, and changes the date format to the day in the middle.
I can sort of fix it by changing the language setting from "PreferredLanguageLocaleName=en-US" to "PreferredLanguageLocaleName=en-GB", but the short datetime format still doesn't match my system settings.
In any case, even after trying the above, I found I could no longer copy and paste the datetime into excel in a way that excel would recognise the string as a datetime value. I determined there was an invisible character being introduced, and thanks to the Convert Char To Hex feature (Ctrl+Alt+X), I was able to see that the Unicode Character 'LEFT-TO-RIGHT MARK' "u200E" was added immediately before each number in the date.
I note that there is an advanced setting "DateTimeFormat=" which may get me out of trouble for now, but I'd rather be able to use the default settings so I don't run into the same problem in the future on a new machine.
Since learning about the "strftime()" string format is overkill solution for a typical user, and the underlying invisible character issue is not easy to spot, I'd consider the fix above to be only used as a temporary measure until an appropriate update is applied.
After some testing, I found the following details and issues. All these settings are found in the [Settings2] section of the Notepad3.ini file.
I referred to https://man7.org/linux/man-pages/man3/strftime.3.html as my source for strftime(), which is mentioned in the relevant section of https://github.com/rizonesoft/Notepad3 .
DateTimeFormat=%c
This adopts the local setting according to PreferredLanguageLocaleName, rather than the OS. It does however remove the "u200E" character, and therefore I would recommend using this as the default setting as a quick fix
DateTimeFormat=%I:%M %p %d/%m/%Y
example: 08:32 AM 04/02/2021
This is the closest I could match my OS setting, with the difference being that the hour and day has padded zero. Using %e would pad the day with space instead, rather then remove it.
I also noted %l and %k , which are the hour version with padded spaces, breaks something, returning "%l:%M %p %e/%m/%Y" instead of the date time instead
For what its worth, I've decided to adopt the 24 hour setting with padded zeros: DateTimeFormat=%H:%M %d/%m/%Y
Cheers!
Hello @ShannanHeinitz ,
Below, 2 closed issues with some explanations:
Thanks @hpwamr.
I just confirmed both issue I mentioned exist in the latest Beta version, Notepad3_5.21.125.1_beta
I confirm the parasites characters in Date (below a view with "HxD - Hex Editor"
17:55 ‎04/‎02/‎2021
15:55 04/01/2021
17:55 ‎04 ‎February ‎2021
17:55 04 February 2021
If [Settings2] DateTimeFormat= resp. [Settings2] DateTimeLongFormat= is specified,
the defined format string is used to generate the date/time string according to the wcsftime() specification.
If [Settings2] DateTimeFormat= resp. [Settings2] DateTimeLongFormat= is empty (the default),
NP3 uses EnumDateFormatsExEx()
Method to find the corresponding short/long date format for the configured Language Locale
(PreferredLanguageLocaleName, Menu->Settings->Language).
The returned format injects the Left-to-Right Mark (LRM) reading specifier - I will try to remove it from the final string.
Maybe a switch "Use OS Date/Time specification vs. Use configured Language Locale Date/Time specification would be an option to consider too 🤔
Thanks @RaiKoHoff , I'll check it out over the weekend.
I did note, as per your change summary that you've added a tab, and switched the date to be first. Neither of these were the case in the earlier code, nor would it match existing region settings as far as I can tell.. Would your change only affect locale setting or when selected as per language setting?
For reference, in earlier version of notepad3, ctrl+F5 produced the following format:
H:MM AM d/m/yyyy
example: 8:32 AM 4/02/2021 (note lack of padding, although I don't personally mind either way)
The addition of tab in my opinion will cause more issues too. For example, when copying pasting into an excel document, the tab would cause the date and time be separated into neighbouring cells instead of remaining together.
<date> <time> is more "natural" - also ISO 8601 format specification (e.g. 2021-02-05T08:13) uses <date>T<time> order 🤔en-US => 8:38 AM 2/5/2021 vs. en-GB => 08:38 05/02/2021)
- Okay, I will revert the TAB separator, using one(1) blank as space between date and time.
(Maybe more than one(1) blank makes it more readable ?)
Hello @RaiKoHoff
Well after reflection and tests, one(1) blank seems me ok. 🤔
Now, Time Date or Date time, it think that default of Notepad3 should beTime Date ?
Below is a list of formats used by some text editors.
5/févr./2021 10:01
EditPlus
5/02/2021
vendredi 5 février 2021
10:03
10:03:59
EmEditor
10:05 5/02/2021
Notepad++
9:55 5/02/2021
9:56 vendredi 5 février 2021
Notepad2
10:07 5/02/2021
10:07 vendredi 5 février 2021
Notepad2-mod
9:59 5/02/2021
9:59 vendredi 5 février 2021
Notepad2e
10:08 5/02/2021
10:08 vendredi 5 février 2021
Notepad2-zufuliu
10:09 5/02/2021
10:09 vendredi 5 février 2021
Sublime
5/02/2021 10:30:07
TextEditorPro
5/02/2021 10:32:27
UltraEdit
5/02/2021 10:33:50
VSCode
2021-02-05 10:46:54
Hello @ShannanHeinitz ,
Feel free to test the "BETA/RC PortableApps" version "Notepad3Portable_5.21.205.1_beta.paf" or newer, see below or issue #1129.
"Notepad3Portable BETA/RC PortableApps" version can be used with or without ".7z" extension.
To update your "Notepad3 Setup" version with the latest features/fixes from the "BETA/RC" version, see issue #1105.
Also, feel free to test the "BETA/RC Setup" version "Notepad3_5.21.205.1_beta_Setup" or newer, see below or issue #1129.
Comments and suggestions are welcome... 😃
Perfect! It behaves the way it use to :)
Quick demo below:
Default (OS settings)
9:25 PM 6/02/2021
en-US + Language Defines DateTime
9:25 PM 2/6/2021
en-GB + Language Defines DateTime
21:25 06/02/2021
Most helpful comment
If
[Settings2] DateTimeFormat=resp.[Settings2] DateTimeLongFormat=is specified,the defined format string is used to generate the date/time string according to the wcsftime() specification.
If
[Settings2] DateTimeFormat=resp.[Settings2] DateTimeLongFormat=is empty (the default),NP3 uses EnumDateFormatsExEx()
Method to find the corresponding short/long date format for the configured Language Locale
(
PreferredLanguageLocaleName,Menu->Settings->Language).The returned format injects the
Left-to-Right Mark (LRM)reading specifier - I will try to remove it from the final string.Maybe a switch "
Use OS Date/Time specificationvs.Use configured Language Locale Date/Time specificationwould be an option to consider too 🤔