Comments (5)
Reopening this after some more digging.
Reason: Certain time-zones (esp. in Asia) have offsets depending on the date (i.e. Singapore/Kuala Lumpur) - guessing the time-zone without passing in a fully qualified date/time object can't possibly work (unless I am again missing something).
I believe this is part of the problem (from time.js/getValidTimeData):
const formatTime = moment(1970-01-01 ${validTime}
, YYYY-MM-DD ${hourFormat}
, 'en');
For Singapore and KualaLumpur this will cause 30min off. As they changed their offset in 1982.
See: moment/moment-timezone#490
A potential fix could be to pass in a reference date which is used instead of 1970-01-01.
IMHO - the best would be to pass in time as a moment object directly. As there is anyway a dependency on moment within the code. OR remove any TZ handling within the library and let the caller handle it.
Br
Fredrik
from react-times.
Tried to replicate in a standalone environment without luck.
However, there is a difference between FF (57.0.1) and Chrome (62.0.3202.94).
Maybe I am just doing something stupid. Would be good if it was possible to disable any tz handling and just have the picker work with raw hours/minutes leaving it up to caller/user to deal with.
Note: the minutes diff in the screenshot and actual time is due to me writing the comment..
from react-times.
This most likely not an issue with react-times. I am seeing other very strange things right now.
Sorry...
from react-times.
Wow! Thanks a lot for your research! It seems really a problem and can not fixed quickly in react-times it self, but may be it's a good idea to allow module user handle it by themselves. And I think we can invite @carlodicelico and @erin-doyle to discuss this problem -- they did a lot great work to embed timezone function in react-times.
Thanks again for your advice!
from react-times.
If changed to 'let user deal with it' - you would break backwards compatibility, which is problematic in itself.
One option would be to have a property called 'reference time'. Default this property to currently used 1970-01-01. This would retain backwards compatibility but also allow for users to override. In my case I would simply set it to 'moment()'.
from react-times.
Related Issues (20)
- Styles not work with css modules HOT 1
- Warning: Can't call setState (or forceUpdate) on an unmounted component.
- Calendar picker with similar aesthetic HOT 2
- Check the render method of `TwentyFourHoursMode`. HOT 3
- Costumize pointer color HOT 1
- Perssistent mode HOT 1
- In 12-hour mode (material theme), hour should read "12" instead of "00" HOT 3
- Update the active styles on dropdown
- Classic theme is not responsive.
- Keyboard input for accessibility?
- Pointers always point to default time even after time updated
- In 24 hour mode clock head shows incorrect time
- Incorrect time on some hour HOT 1
- Disable intervals
- onFocusChange not called when timepicker popup closed. HOT 2
- Disabled component HOT 3
- Center screen on mobile HOT 2
- [Storybook] example for default time not working
- PickerPoint position issue HOT 1
- Does not work with latest version of react? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-times.