Giter Club home page Giter Club logo

tz.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tz.js's Issues

npm files list

This is packing a few files that npm doesn't need and making it look bigger than it really is.

demo shows a .timeZone function that doesn't actually exist

> TZ
{
  toOffsetISOString: [Function: toOffsetISOString],
  formatOffset: [Function: formatOffset],
  toLocalISOString: [Function: toLocalISOString],
  toTimeZone: [Function: toTimeZone],
  toTimeZoneISOString: [Function: toTimeZoneISOString],
  toUTC: [Function: fromTimeZone],
  fromTimeZone: [Function: fromTimeZone],
  toUTCISOString: [Function: toOffsetISOString]
}
> TZ.timeZone();
Uncaught TypeError: TZ.timeZone is not a function

Add `xtzDate.toDate()`

Either of these would work:

xtzDate.toDate = function () {
  return new Date(xtzDate.toISOString());
};
xtzDate.toDate = function () {
  return new Date(xtzDate.year, xtzDate.month, xtzDate.date, xtzDate.hour, xtzDate.minute, xtzDate.second, xtzDate.millisecond);
};

Suggestion for date object returned by toUTC

I see that toUTC returns an object. I find this preferable to the way other libraries do it because then I can build out the format I need. However, I don't have all the pieces I really want.

Would it be better for the object to contain all the formats of the various date parts according to the unicode symbols? Intl.DateTimeFormat().resolvedOptions().timeZone;

Use current local timezone when none is specified

datetime-local does not accept a format that the Date object can provide, and does not give a format that the Date object understands...

<input type="datetime-local"></input>

The datetime-local requires the value in the format YYYY-MM-DDThh:mm[:ss[.sss]]. For this use case it would be nice to be able to do XTZ.toUTC(new date()).toISOString() or XTZ.toISOLocaleString(new Date())... or something

function (x, tz = new Intl.DateTimeFormat().resolvedOptions().timeZone) {
  // ...
}

Also, the name toUTC may be misleading... it's more like toUTCOffset or toISOOffset.

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.