[Webkit-unassigned] [Bug 230827] New: Intl.DateTimeFormat returns 2 digit years when type is 'numeric'

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 27 05:22:11 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=230827

            Bug ID: 230827
           Summary: Intl.DateTimeFormat returns 2 digit years when type is
                    'numeric'
           Product: WebKit
           Version: Other
          Hardware: iPhone / iPad
                OS: Other
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: davidcwebster at gmail.com

This bug occurs in Safari on iOS 15.

When Intl.DateTimeFormat is formatting a year, and the configuration for year is 'numeric', it returns a two-digit year. However, I expect the full year. Previous versions returned the full year, and other browsers (including Safari 15 on OSX) return the full year.

Here's a code sample:

const dtf = new Intl.DateTimeFormat('en-AU', { timeZone: 'Australia/Melbourne', year: 'numeric' });
const date = new Date();
const parts = dtf.formatToParts(date);
const year = parts.find(part => part.type === 'year')
console.log(year.value)
// expected output is "2021", but in Safari 15 on iOS, it's "21".

You can try this at https://jsfiddle.net/davidwebster/0b6qfu34/5/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210927/75adf30a/attachment-0001.htm>


More information about the webkit-unassigned mailing list