DateInput test is not passing for other time zones
See original GitHub issueexcept for a date-related one because the test doesn’t allow for my +10 timezone.
Expected Behavior
all tests should pass
no errors
Actual Behavior
Different time zones fail the dateinput
test
URL, screen shot, or Codepen exhibiting the issue
Steps to Reproduce
Your Environment
- Grommet version:
- Browser Name and version:
- Operating System and version (desktop or mobile):
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Components using Date objects produce different snapshots ...
When I run my test in different timezones, this produces different snapshots, because the Date(year, month, ...) constructor creates the date in ...
Read more >Date input taking into account users time zone offset
I have an input field that is binding to a backing Task in the controller to allow users to enter a date into...
Read more >How to make date input / date picker display the date as if it ...
How to make date input / date picker display the date as if it was UTC, not local time? 1 Answer 5867 Views....
Read more ><input type="datetime-local"> - HTML - MDN Web Docs
Setting timezones One thing the datetime-local input type doesn't provide is a way to set the time zone and/or locale of the date/time...
Read more >Working with Dates, Time, Timezones in GraphQL ... - Hasura
If you are wondering which data type to use for what use case, check out the video from Adron going over the types...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wish I had made this issue when I came across it the first time. From memory the problem is when the “correct” datetime is dinked together as a string with
timezoneOffset
, which is made like this:In Australia my timezone is +10, which makes a negative timezoneOffset, but a negative number is less than 10 so it gets prepended with a
0
by that code. Then, subsequent dates assembled like this:…are crazy looking.
If I get a chance over the next few weekends I’ll try for a fix. Hopefully I can work out something that works in all timezones but doesn’t require adding Moment or date-fns or whatever to the deps.
Post a comment here if you start working on this so I can ping you and we don’t double up
I am wondering if we should update this test somehow – it seems part of the issue that has been happening is due to daylight savings timezone. According to this thread, there are functions we could create to see if a caller is in standard time or daylight savings, but according to the discussion under the reply it doesn’t necessarily seem like it’s fully reliable:
https://stackoverflow.com/a/11888430