Closed Bug 1512808 Opened 2 years ago Closed 2 years ago

filter rule date format broken

Categories

(MailNews Core :: Filters, defect)

defect
Not set
normal

Tracking

(thunderbird_esr6064+ fixed, thunderbird64 wontfix, thunderbird65 fixed)

RESOLVED FIXED
Thunderbird 65.0
Tracking Status
thunderbird_esr60 64+ fixed
thunderbird64 --- wontfix
thunderbird65 --- fixed

People

(Reporter: aceman, Assigned: aceman)

References

Details

Attachments

(1 file, 1 obsolete file)

It seems the recent changes to date formatting according to locale has broken our display of dates in filter rules.

When editing a filter, select Date as a term in filter criteria. Notice the sample date showing in the value field.

It shows 8.2018.12 (8th Dec 2018) for me, which is complete nonsense for either en_US or sk_SK locale that come into play in my TB environment.
Attached patch 1512808.patch (obsolete) — Splinter Review
Using Services.intl.DateTimeFormat() in initLocaleShortDateFormat() may return strings with spaces, which we didn't expect. E.g. in may case it was "8. 12. 2018".
Attachment #9030089 - Flags: review?(jorgk)
Comment on attachment 9030089 [details] [diff] [review]
1512808.patch

Review of attachment 9030089 [details] [diff] [review]:
-----------------------------------------------------------------

Can we make this two patches, please, the clean-up should go separate. I can't see the forest for the trees.

::: mailnews/base/content/dateFormat.js
@@ +24,5 @@
>    try {
>      const dateFormatter = new Services.intl.DateTimeFormat(undefined,
>        { dateStyle: "short" });
>      var aDate = new Date(1999, 11, 1);
> +    var dateString = dateFormatter.format(aDate).replace(/ /g,"");

This is the net change, the rest is boy-scout clean-up which obscures it.

@@ +34,2 @@
>      {
> +      arrayOfStrings = dateString.split( possibleSeparators[i]);

Another space after the (.
Attachment #9030089 - Flags: review?(jorgk) → review+
Attached patch 1512808.patch v2Splinter Review
Yes, thanks.
Attachment #9030089 - Attachment is obsolete: true
Attachment #9030111 - Flags: review+
Affects multiple locales now containing spaces, e.g. "sk", "cs", "hr", "hu".
Others like "en", "fr", "es", "ru" are OK.
Blocks: 1512837
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/c3afcea69ad2
fix date format detection in initLocaleShortDateFormat(). r=jorgk DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 65.0
Comment on attachment 9030111 [details] [diff] [review]
1512808.patch v2

I assume that's a problem in TB 60 as well.
Attachment #9030111 - Flags: approval-comm-esr60+
No, it does not happen on TB60 on the same machine. But it shouldn't hurt if you land it there too.
Ok, the 2 versions of TB run under different users, there may be different settings of the desktop environment, if that is taken into account in any way.
Right, it does happen in TB60 under the same user as trunk.
Thanks for confirming, I've already landed it on the ESR release ;-)
You need to log in before you can comment on or make changes to this bug.