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

iOS/webkit: Invalid Date #179

Open
strarsis opened this issue Mar 16, 2022 · 2 comments
Open

iOS/webkit: Invalid Date #179

strarsis opened this issue Mar 16, 2022 · 2 comments

Comments

@strarsis
Copy link

strarsis commented Mar 16, 2022

A KnexJS/SQLite date type field is used as source for a react-admin <DateField.
On PC/Android Chrome/Firefox the field can parse the source value as date and display it formatted.
On iOS/webkit the <DateField however render Invalid Date.

Example date value: 2022-03-15 21:32:21 (year-month-day hour:minute:seconds).

Related, older SO discussion: https://stackoverflow.com/questions/52508501/react-admin-invalid-date-in-safari

@josx
Copy link
Owner

josx commented Mar 17, 2022

Maybe it is related that you are using date input and trying to send a datetime.
But It seems not to be a ra-data-feathers bug.

@strarsis
Copy link
Author

strarsis commented Mar 17, 2022

The issue occurs with <DateField />s. I haven't used date/time inputs, I don't know if the issue also occurs for input components.

Edit: Workaround for making those dates compatible with iOS Safari + proper timezone:

export const iso8601WTz = (dateStr: string): string => {
  const date = parseJSON(dateStr);
  return date.toISOString();
}

This is currently applied to all date fields responses in a FeathersJS hook.

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

No branches or pull requests

2 participants