Giter Site home page Giter Site logo

Comments (5)

gnilk avatar gnilk commented on July 28, 2024 1

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.

gnilk avatar gnilk commented on July 28, 2024

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.

Firefox:
image

Chrome:
image

Note: the minutes diff in the screenshot and actual time is due to me writing the comment..

from react-times.

gnilk avatar gnilk commented on July 28, 2024

This most likely not an issue with react-times. I am seeing other very strange things right now.
Sorry...

from react-times.

ecmadao avatar ecmadao commented on July 28, 2024

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.

gnilk avatar gnilk commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.