Skip to content

Commit b370752

Browse files
committed
Updated PLUGINS.md
1 parent 729b469 commit b370752

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

PLUGINS.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ date.plugin('foobar');
7676
- It adds `timeSpan()` function that calculates the difference of two dates to the library.
7777

7878
- [timezone](#timezone)
79-
- It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zone names` to the library.
79+
- It adds `formatTZ()`, `parseTZ()`, `transformTZ()`, `addYearsTZ()`, `addMonthsTZ()` and `addDaysTZ()` that support `IANA time zone names` to the library.
8080

8181
- [two-digit-year](#two-digit-year)
8282
- It adds two-digit year notation to the parser.
@@ -290,7 +290,7 @@ In these functions can be available some tokens to format the calculation result
290290

291291
### timezone
292292

293-
It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zone names` (`America/Los_Angeles`, `Asia/Tokyo`, and so on) to the library.
293+
It adds `formatTZ()`, `parseTZ()`, `transformTZ()`, `addYearsTZ()`, `addMonthsTZ()` and `addDaysTZ()` that support `IANA time zone names` (`America/Los_Angeles`, `Asia/Tokyo`, and so on) to the library.
294294

295295
#### formatTZ(dateObj, arg[, timeZone])
296296

@@ -299,7 +299,7 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
299299
- @param {**string**} [timeZone] - Output as this time zone
300300
- @returns {**string**} A formatted string
301301

302-
`formatTZ()` is upward compatible with `format()`. Tokens available for `arg` are the same as those for `format()`. If `timeZone` is omitted, this function assumes `timeZone` to be a local time zone and outputs a string. This means that the result is the same as when `format()` is used.
302+
`formatTZ()` is upward compatible with `format()`. Tokens available for `arg` are the same as those for `format()`. If `timeZone` is omitted, this function assumes `timeZone` to be the local time zone and outputs a string. This means that the result is the same as when `format()` is used.
303303

304304
#### parseTZ(dateString, arg[, timeZone])
305305

@@ -308,7 +308,7 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
308308
- @param {**string**} [timeZone] - Input as this time zone
309309
- @returns {**Date**} A Date object
310310

311-
`parseTZ()` is upward compatible with `parse()`. Tokens available for `arg` are the same as those for `parse()`. `timeZone` in this function is used as supplemental information. if `dateString` contains a time zone offset value (i.e. -0800, +0900), `timeZone` is not be used. If `dateString` doesn't contain a time zone offset value and `timeZone` is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `parse()` is used.
311+
`parseTZ()` is upward compatible with `parse()`. Tokens available for `arg` are the same as those for `parse()`. `timeZone` in this function is used as supplemental information. if `dateString` contains a time zone offset value (i.e. -0800, +0900), `timeZone` is not be used. If `dateString` doesn't contain a time zone offset value and `timeZone` is omitted, this function assumes `timeZone` to be the local time zone. This means that the result is the same as when `parse()` is used.
312312

313313
#### transformTZ(dateString, arg1, arg2[, timeZone])
314314

@@ -318,7 +318,34 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
318318
- @param {**string**} [timeZone] - Output as this time zone
319319
- @returns {**string**} A formatted string
320320

321-
`transformTZ()` is upward compatible with `transform()`. `dateString` must itself contain a time zone offset value (i.e. -0800, +0900), otherwise this function assumes it is a local time zone. Tokens available for `arg1` are the same as those for `parse()`, also tokens available for `arg2` are the same as those for `format()`. `timeZone` is a `IANA time zone names`, which is required to output a new formatted string. If it is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `transform()` is used.
321+
`transformTZ()` is upward compatible with `transform()`. `dateString` must itself contain a time zone offset value (i.e. -0800, +0900), otherwise this function assumes it is the local time zone. Tokens available for `arg1` are the same as those for `parse()`, also tokens available for `arg2` are the same as those for `format()`. `timeZone` is a `IANA time zone names`, which is required to output a new formatted string. If it is omitted, this function assumes `timeZone` to be the local time zone. This means that the result is the same as when `transform()` is used.
322+
323+
#### addYearsTZ(dateObj, years[, timeZone])
324+
325+
- @param {**Date**} dateObj - A Date object
326+
- @param {**number**} years - The number of years to add
327+
- @param {**string**} [timeZone] - The time zone to use for the calculation
328+
- @returns {**Date**} The Date object after adding the specified number of years
329+
330+
`addYearsTZ()` can calculate adding years in the specified time zone regardless of the execution environment.
331+
332+
#### addMonthsTZ(dateObj, months[, timeZone])
333+
334+
- @param {**Date**} dateObj - A Date object
335+
- @param {**number**} months - The number of months to add
336+
- @param {**string**} [timeZone] - The time zone to use for the calculation
337+
- @returns {**Date**} The Date object after adding the specified number of months
338+
339+
`addMonthsTZ()` can calculate adding months in the specified time zone regardless of the execution environment.
340+
341+
#### addDaysTZ(dateObj, days[, timeZone])
342+
343+
- @param {**Date**} dateObj - A Date object
344+
- @param {**number**} days - The number of days to add
345+
- @param {**string**} [timeZone] - The time zone to use for the calculation
346+
- @returns {**Date**} The Date object after adding the specified number of days
347+
348+
`addDaysTZ()` can calculate adding days in the specified time zone regardless of the execution environment.
322349

323350
```javascript
324351
const date = require('date-and-time');

0 commit comments

Comments
 (0)