Giter Site home page Giter Site logo

UTC support about globalize HOT 2 CLOSED

globalizejs avatar globalizejs commented on May 15, 2024
UTC support

from globalize.

Comments (2)

yucca42 avatar yucca42 commented on May 15, 2024

Formatting a Date value as UTC is a common need, but I wonder whether it would best be left to people using the library, rather than adding functions to it. After all, this is different from normal localization of rendering: you first need to convert the value to UTC (at least conceptually), then render that value in a localized manner. And if Iā€™m not mistaken, you could convent a Date value in local time to a Date value in UTC e.g. as follows:

function UTC(datetime) {
var u = datetime;
u.setMinutes(u.getMinutes() + u.getTimezoneOffset());
return u; }

from globalize.

rxaviers avatar rxaviers commented on May 15, 2024

Globalize 1.x also avoids handling this kind of manipulation, since this can be handled at user side with no loss. Feel free to add new comments if you think this is not true providing examples please.

By the way, Globalize supports formatting and parsing timezones that doesn't require any additional logic to the Native JavaScript Date Object. We call it basic timezone support. It means no other timezones than the local user environment's. It also means no Olson/IANA timezone names. More information can be found on #202.

For more information of a possible implementation of Olson-timezone-ExtendedDate support can be found here: #340.

from globalize.

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.