You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PLUGINS.md
+32-5Lines changed: 32 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ date.plugin('foobar');
76
76
- It adds `timeSpan()` function that calculates the difference of two dates to the library.
77
77
78
78
-[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.
80
80
81
81
-[two-digit-year](#two-digit-year)
82
82
- 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
290
290
291
291
### timezone
292
292
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.
294
294
295
295
#### formatTZ(dateObj, arg[, timeZone])
296
296
@@ -299,7 +299,7 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
299
299
-@param {**string**} [timeZone] - Output as this time zone
300
300
-@returns {**string**} A formatted string
301
301
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.
303
303
304
304
#### parseTZ(dateString, arg[, timeZone])
305
305
@@ -308,7 +308,7 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
308
308
-@param {**string**} [timeZone] - Input as this time zone
309
309
-@returns {**Date**} A Date object
310
310
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.
@@ -318,7 +318,34 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
318
318
-@param {**string**} [timeZone] - Output as this time zone
319
319
-@returns {**string**} A formatted string
320
320
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.
0 commit comments