Skip to content

Commit

Permalink
Update the constants docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Dec 16, 2023
1 parent 8ebaa1f commit fc93a5c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* @description
* Collection of useful date constants.
*
* The constants could be imported from `date-fns/constants` or directly from `date-fns`:
* The constants could be imported from `date-fns/constants`:
*
* ```ts
* import { maxTime } from 'date-fns/constants'
* import { minTime } from 'date-fns'
* import { maxTime, minTime } from "date-fns/constants";
*
* function isAllowedTime(time) {
* return time <= maxTime && time >= minTime;
Expand Down Expand Up @@ -44,12 +43,12 @@ export const daysInYear = 365.2425;
* @summary Maximum allowed time.
*
* @example
* import { maxTime } from 'date-fns'
* import { maxTime } from "date-fns/constants";
*
* const isValid = 8640000000000001 <= maxTime
* const isValid = 8640000000000001 <= maxTime;
* //=> false
*
* new Date(8640000000000001)
* new Date(8640000000000001);
* //=> Invalid Date
*/
export const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
Expand All @@ -60,9 +59,9 @@ export const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
* @summary Minimum allowed time.
*
* @example
* import { minTime } from 'date-fns'
* import { minTime } from "date-fns/constants";
*
* const isValid = -8640000000000001 >= minTime
* const isValid = -8640000000000001 >= minTime;
* //=> false
*
* new Date(-8640000000000001)
Expand Down

0 comments on commit fc93a5c

Please sign in to comment.