Skip to content

FixBugs for iOS Safari - #25

Open
mahdiyya wants to merge 2 commits into
wwilsman:masterfrom
mahdiyya:master
Open

mahdiyya wants to merge 2 commits into
wwilsman:masterfrom
mahdiyya:master

Conversation

@mahdiyya

@mahdiyya mahdiyya commented May 2, 2025 •

Copy link
Copy Markdown

Hi @wwilsman

Fix a crash that occurs only in iOS Safari when the page is restored from the Back-Forward cache. In that scenario, the value passed to serialize() is no longer a Date instance, so date.toLocaleDateString() throws:

TypeError: date.toLocaleDateString is not a function

Changes
Normalise the incoming value with new Date(date)

Reproduction steps

  1. Open a page that uses Datepicker.js on iOS Safari.
  2. Navigate away, then tap Back (BF-cache).
  3. The picker fails to render, and the error above appears in the console.

Let me know if you'd like anything tweaked.

Thanks!
Diyah

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant