forked from iamkun/dayjs
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additions: * Constructor accepts a boolean flag to enable the UTC mode: { utc: true }. * Method utc() returns a clone of the instance in the UTC mode. * Method local() returns a clone of the instance in the non-UTC (local) mode. * Method isUTC() checks, if the instance is in the UITC mode. * Method utcOffset() returns the time zone offset to UTC consistently with Date.prototype.getTimezoneOffset() Differences to the "normal" (local) dayjs mode: * Assume UTC as the time zone of the string passed to the constructor - for example, "2018-10-28" will be parsed as "2018-10-28T00:00:00Z". *But only if the time zone is omitted.* If you end the string tith a TZ offset - "2018-10-28T00:00:00+02:00", it will be retained and the whole date will be converted to UTC, when iniitalizing the datejs object. * Methods returning the date parts like year(), month() etc. return UTC parts using Date.propertotype.getUTC* methods. * Methods manipulating the date - set() - work with the UTC values of the date parts, as the getters above. * The format() method always formats the time zone as "+00:00". * The utcOffset() method always returns zero.
- Loading branch information
Showing
12 changed files
with
379 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.