Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interval.toLocaleString fails for Mobile Safari 14.0.3 #1536

Open
halmeen opened this issue Nov 8, 2023 · 1 comment
Open

Interval.toLocaleString fails for Mobile Safari 14.0.3 #1536

halmeen opened this issue Nov 8, 2023 · 1 comment

Comments

@halmeen
Copy link

halmeen commented Nov 8, 2023

Describe the bug
Interval.toLocaleString fails for Mobile Safari 14.0.3 with the error:
TypeError: this.dtFormatter(e.start,n).dtf.formatRange is not a function. (In 'this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())', 'this.dtFormatter(e.start,n).dtf.formatRange' is undefined)

To Reproduce
Use Interval.toLocaleString in Mobile Safari 14.0.3
Example code:

import { DateTime, Interval } from 'luxon';

Interval.fromDateTimes(
  new Date('2023-11-10T00:00:00Z'),
  new Date('2023-11-20T00:00:00Z')
).toLocaleString(DateTime.DATE_MED_WITH_WEEKDAY);

Actual vs Expected behavior
Actual: TypeError as described above
Expected: No error

Desktop (please complete the following information):

  • OS: iOS 14.4
  • Browser: Safari 14.0.3
  • Luxon version: 3.3.2

Additional context

@diesieben07
Copy link
Collaborator

This is an issue with the documentation, Interval#toLocaleString requires the browser to support Intl.DateTimeFormat#formatRange. iOS Safari only supports this starting with version 14.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants