Closed Bug 1789905 Opened 2 years ago Closed 2 years ago

formatBestUnit() in intl.RelativeTimeFormat should support weeks

Categories

(Core :: Internationalization, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: flod, Assigned: Gijs)

References

Details

Attachments

(1 file)

For some reason, we seem to jump from day to month, with some awkward results when the difference is just over a week

https://searchfox.org/mozilla-central/source/toolkit/components/mozintl/mozIntl.sys.mjs#769

var now = Date.now();
var rtf = new Services.intl.RelativeTimeFormat("en", {
    style: "short", // "narrow" | "short" | "long" (default)
    numeric: "auto", // "always" | "auto" (default)
});

console.log(rtf.formatBestUnit(new Date(now - 8 * 24 * 60 * 1000 * 60)));

// last mo. 
See Also: → 1789663
Blocks: 1789663
See Also: 1789663
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4687a0580982
add 'week' support to mozIntl's formatbestUnit code, r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: