Skip to content

Commit a68533c

Browse files
committed
Updated README.md
1 parent b370752 commit a68533c

1 file changed

Lines changed: 45 additions & 34 deletions

File tree

README.md

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ npm i date-and-time
2525

2626
## Recent Changes
2727

28+
- 3.5.0
29+
- Added `addYearsTZ()`, `addMonthsTZ()`, and `addDaysTZ()` to the `timezone` plugin.
30+
- Revised the approach to adding time and removed the third parameter from `addHours()`, `addMinutes()`, `addSeconds()`, and `addMilliseconds()`.
31+
2832
- 3.4.1
2933
- Fixed an issue where `formatTZ()` would output 0:00 as 24:00 in 24-hour format in Node.js.
3034

3135
- 3.4.0
3236
- Added `zz` (time zone name) and `z` (time zone name abbreviation) tokens to the `timezone` plugin.
3337
- Fixed an issue where token extensions by other plugins were not reflected in functions provided by the `timezone` plugin.
3438

35-
- 3.3.0
36-
- Refactored `format()`, `isValid()`, and `preparse()`, further improved performance.
37-
3839
## Usage
3940

4041
- ES Modules:
@@ -98,16 +99,16 @@ import date from '/path/to/date-and-time.es.min.js';
9899
- [addDays](#adddaysdateobj-days-utc)
99100
- Adding days
100101

101-
- [addHours](#addhoursdateobj-hours-utc)
102+
- [addHours](#addhoursdateobj-hours)
102103
- Adding hours
103104

104-
- [addMinutes](#addminutesdateobj-minutes-utc)
105+
- [addMinutes](#addminutesdateobj-minutes)
105106
- Adding minutes
106107

107-
- [addSeconds](#addsecondsdateobj-seconds-utc)
108+
- [addSeconds](#addsecondsdateobj-seconds)
108109
- Adding seconds
109110

110-
- [addMilliseconds](#addmillisecondsdateobj-milliseconds-utc)
111+
- [addMilliseconds](#addmillisecondsdateobj-milliseconds)
111112
- Adding milliseconds
112113

113114
- [subtract](#subtractdate1-date2)
@@ -434,11 +435,11 @@ date.transform('13:05', 'HH:mm', 'hh:mm A');
434435
### addYears(dateObj, years[, utc])
435436

436437
- @param {**Date**} dateObj - A Date object
437-
- @param {**number**} years - Number of years to add
438-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
439-
- @returns {**Date**} The Date object after adding the value
438+
- @param {**number**} years - The number of years to add
439+
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
440+
- @returns {**Date**} The Date object after adding the specified number of years
440441

441-
Adds years to the date object.
442+
Adds years to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addYearsTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
442443

443444
```javascript
444445
const now = new Date();
@@ -456,11 +457,11 @@ const next_next_year = date.addYears(next_year, 1, true); // => Feb 28 2022
456457
### addMonths(dateObj, months[, utc])
457458

458459
- @param {**Date**} dateObj - A Date object
459-
- @param {**number**} months - Number of months to add
460-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
461-
- @returns {**Date**} The Date object after adding the value
460+
- @param {**number**} months - The number of months to add
461+
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
462+
- @returns {**Date**} The Date object after adding the specified number of months
462463

463-
Adds months to the date object.
464+
Adds months to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addMonthsTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
464465

465466
```javascript
466467
const now = new Date();
@@ -478,57 +479,67 @@ const next_next_month = date.addMonths(next_month, 1, true); // => Mar 28 202
478479
### addDays(dateObj, days[, utc])
479480

480481
- @param {**Date**} dateObj - A Date object
481-
- @param {**number**} days - Number of days to add
482-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
483-
- @returns {**Date**} The Date object after adding the value
482+
- @param {**number**} days - The number of days to add
483+
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
484+
- @returns {**Date**} The Date object after adding the specified number of days
485+
486+
Adds days to a date object. Subtraction is also possible by specifying a negative value. If the third parameter is false or omitted, this function calculates based on the system's default time zone. If you need to obtain calculation results based on a specific time zone regardless of the execution system, consider using the `addDaysTZ()`, which allows you to specify a time zone name as the third parameter. See [PLUGINS.md](./PLUGINS.md) for details.
484487

485488
```javascript
486489
const now = new Date();
487490
const yesterday = date.addDays(now, -1);
488491
```
489492

490-
### addHours(dateObj, hours[, utc])
493+
### addHours(dateObj, hours)
491494

492495
- @param {**Date**} dateObj - A Date object
493-
- @param {**number**} hours - Number of hours to add
494-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
495-
- @returns {**Date**} The Date object after adding the value
496+
- @param {**number**} hours - The number of hours to add
497+
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
498+
- @returns {**Date**} The Date object after adding the specified number of hours
499+
500+
Adds hours to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
496501

497502
```javascript
498503
const now = new Date();
499504
const an_hour_ago = date.addHours(now, -1);
500505
```
501506

502-
### addMinutes(dateObj, minutes[, utc])
507+
### addMinutes(dateObj, minutes)
503508

504509
- @param {**Date**} dateObj - A Date object
505-
- @param {**number**} minutes - Number of minutes to add
506-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
507-
- @returns {**Date**} The Date object after adding the value
510+
- @param {**number**} minutes - The number of minutes to add
511+
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
512+
- @returns {**Date**} The Date object after adding the specified number of minutes
513+
514+
Adds minutes to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
508515

509516
```javascript
510517
const now = new Date();
511518
const two_minutes_later = date.addMinutes(now, 2);
512519
```
513520

514-
### addSeconds(dateObj, seconds[, utc])
521+
### addSeconds(dateObj, seconds)
515522

516523
- @param {**Date**} dateObj - A Date object
517-
- @param {**number**} seconds - Number of seconds to add
518-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
519-
- @returns {**Date**} The Date object after adding the value
524+
- @param {**number**} seconds - The number of seconds to add
525+
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
526+
- @returns {**Date**} The Date object after adding the specified number of seconds
527+
528+
Adds seconds to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
520529

521530
```javascript
522531
const now = new Date();
523532
const three_seconds_ago = date.addSeconds(now, -3);
524533
```
525534

526-
### addMilliseconds(dateObj, milliseconds[, utc])
535+
### addMilliseconds(dateObj, milliseconds)
527536

528537
- @param {**Date**} dateObj - A Date object
529-
- @param {**number**} milliseconds - Number of milliseconds to add
530-
- @param {**boolean**} [utc] - Calculates as UTC `Added in: v3.0.0`
531-
- @returns {**Date**} The Date object after adding the value
538+
- @param {**number**} milliseconds - The number of milliseconds to add
539+
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
540+
- @returns {**Date**} The Date object after adding the specified number of milliseconds
541+
542+
Adds milliseconds to a date object. Subtraction is also possible by specifying a negative value. The third parameter was deprecated in version 3.5.0. Regardless of what is specified for this parameter, the calculation results will not change.
532543

533544
```javascript
534545
const now = new Date();

0 commit comments

Comments
 (0)