Comments (2)
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.
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)
- api.globalizejs.com status? HOT 1
- `"short"` date skeleton parses single-digit years HOT 1
- Unit Formatter Returning Internal Error with CLDR v40.0.0 HOT 5
- Force positive sign HOT 1
- Unit formatting megabyte in Polish short form failed because [email protected] has inconsistent data HOT 1
- Cannot get timezone names or the abbreviations from globalizer
- unitFormatter throw exception for locale "pl" with cldr-data 35 HOT 3
- Extend number format to use string instead of number HOT 4
- skeleton: "Bhm" is not supported HOT 1
- parseDate sets the time forward by an hour for non DST date time HOT 2
- Potential security issue HOT 1
- index.html
- Percent format and parsing HOT 2
- Module not found: Error: Cannot resolve module 'cldr' - in cypress tests
- Active development status check ???? HOT 1
- new Func() in globalize dist folder HOT 1
- important! How to convert date to custom format?
- Globalize date formatter prints quotes around string literals when using short formats
- Globalize date formatter prints quotes around string literals when using short formats
- Make the constructor case-insensitive 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 globalize.