Skip to content

Commit

Permalink
feat(date): add date function, which constructs a date
Browse files Browse the repository at this point in the history
This is really just an alias for normalize.
  • Loading branch information
djcsdy committed Jan 25, 2024
1 parent 1d5da42 commit a0b4adb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ export function validate(date: Readonly<Date>): void {
}
}

/**
* Constructs a normalized date object from the specified year, month and day.
*
* If the month or day fields are outside the valid range, then they will
* roll over into the next month or year.
*/
export function date(date: Readonly<Date>): Date {
return normalize(date);
}

/**
* Normalizes the specified date object so that it represents a valid date.
*
Expand Down

0 comments on commit a0b4adb

Please sign in to comment.