Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "djz", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Timezone-aware better Javascript Date", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs", |
@@ -17,3 +17,3 @@ # djz - Timezone-aware better Javascript Date | ||
`Dateo` is a sub-class of Date. It has all the methods of Date, some of them are overrided to be timezone-aware, and some of them are added for convenience. | ||
`Dateo` is a sub-class of Date. It has all the methods of Date, some of them are overrided to be timezone-aware, and some methods are added for convenience. | ||
@@ -23,3 +23,3 @@ ## List of overrided and new methods: | ||
### Static method | ||
- `set/get Date.defaultOffset`: set/get the default timezone offset in hour (no sign reverse. For example: GMT+9 is 9). The default value is 0. | ||
- `set/get Dateo.defaultOffset`: set/get the default timezone offset in hour (no sign reverse. For example: GMT+9 is 9). The default value is 0. | ||
@@ -34,7 +34,7 @@ ### Wallclock methods | ||
For example: `date.setFullYear(year => year + 1)`, `date.setFullYear(2020)`, `date.setFullYear()`, `date.setFullYear(() => undefined)`. | ||
For example: `date.fullYear = y => y + 1`, `date.fullYear = 2020`, `date.fullYear = undefined`, `date.fullYear = () => undefined`. | ||
- `getWallclock()` | ||
- `setWallclock()`: set the wallclock and return the Dateo instance. Example: `date.setMonth(x => x + 1).setDate(1) === date`. | ||
- `withWallclock()`: return a new Dateo instance with the wallclock set. Example: `date.withWallclock({month: 1, date: 1}) !== date`. | ||
- `withWallclock()`: return a new Dateo instance with the wallclock set. Example: `date.withWallclock(wallclock) !== date`. | ||
@@ -72,3 +72,3 @@ Besides, `day` wallclock is get only. | ||
All constructors support the last optional `options` argument. The `options` is an object with the following properties: | ||
- `offset`: timezone offset. If not specified, `Date.defaultOffset` is used. | ||
- `offset`: timezone offset. If not specified, `Dateo.defaultOffset` is used. | ||
@@ -85,3 +85,3 @@ The following constructors are supported. | ||
It is stricter than the native `Date` constructor, but more consistent. | ||
The supported formats are: | ||
The supported formats are: `[<Date>][[T]<Time><Zone>]`. Specifically: | ||
- `<Date>` | ||
@@ -97,3 +97,3 @@ - `<Date>T<Time>` | ||
- `<Date>`: `YYYY-MM-DD`, `YYYY-MM`, `YYYY`. | ||
- `<Time>`: `HH:mm:ss.sss`, `HH:mm:ss`, `HH:mm`. | ||
- `<Time>`: `HH:mm:ss.sss`, `HH:mm:ss`, `HH:mm`, `HH`. | ||
- `<Zone>`: `Z`, `+HH`, `-HH`, `+HH:mm`, `-HH:mm`, `+HHmm`, `-HHmm`. | ||
@@ -122,5 +122,7 @@ | ||
- `T05:19Z` | ||
- `T05Z` | ||
- `05:19:52.000Z` | ||
- `05:19:52Z` | ||
- `05:19Z` | ||
- `05Z` | ||
@@ -127,0 +129,0 @@ The timezone offset specified in the string argument determines the absolute time of the argument, it does not affect the value of the timezone of Dateo instance. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130
41858
1055