Skip to content

Add support for dateStyle and timeStyle on toLocale*String functions #161

Open
@vincentjames501

Description

@vincentjames501

Issue Description

Date.toLocaleDateString(), Date.toLocaleTimeString, and Date.toLocaleString do not support dateStyle and timeStyle options (and likewise with Intl.DateTimeFormat.format). The options are ignored on Android.

This is what I'd expect when comparing to the browser and iOS.

new Date().toLocaleDateString([], {dateStyle: 'short'})
'1/14/22'
new Date().toLocaleDateString([], {dateStyle: 'medium'})
'Jan 14, 2022'
new Date().toLocaleDateString([], {dateStyle: 'long'})
'January 14, 2022'
new Date().toLocaleDateString([], {dateStyle: 'full'})
'Friday, January 14, 2022'
new Date().toLocaleTimeString([], {timeStyle: 'short'})
'12:16 PM'
new Date().toLocaleTimeString([], {timeStyle: 'medium'})
'12:16:57 PM'
new Date().toLocaleTimeString([], {timeStyle: 'long'})
'12:17:06 PM PST'
new Date().toLocaleTimeString([], {timeStyle: 'full'})
'12:17:15 PM Pacific Standard Time'

Version, config, any additional info

We're using "jsc-android": "250230.2.1",.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions