Skip to content

Commit

Permalink
docs: update documentation to account for new type discriminator field
Browse files Browse the repository at this point in the history
  • Loading branch information
djcsdy committed Jan 25, 2024
1 parent 24ee013 commit 954f531
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,13 @@ export function daysInMonth(month: number, year: number): number {
}

/**
* Tests if the specified value has the shape of a `Date` object.
* Returns `true` if the specified value has the shape of a `Date` object.
*
* Returns `true` if the value is an object with numeric `year`, `month` and
* `day` fields.
* The `year`, `month` and `day` fields may be non-integers or outside the
* valid range, meaning that the object may not represent a valid date.
*
* The fields may be non-integers or outside the valid range, meaning that the
* object may not represent a valid date.
*
* To also test that the `year`, `month`, `day` fields are integers within the
* valid range, use {@link isValidDate} instead.
* To also test that the `year`, `month` and `day` fields are integers within
* the valid range, use {@link isValidDate} instead.
*/
export function isDate(value: unknown): value is Date {
return (
Expand All @@ -153,8 +150,8 @@ export function isDate(value: unknown): value is Date {
/**
* Tests if the specified value is a `Date` object representing a valid date.
*
* Returns `true` if the value is an object with a numeric `year`, `month` and
* `day` fields and the fields are all integers inside the valid range.
* Returns `true` if the value has the shape of a `Date` object and the `year`,
* `month`, and `day` fields are all integers inside the valid range.
*/
export function isValidDate(value: unknown): value is Date {
return isDate(value) && isValid(value);
Expand Down

0 comments on commit 954f531

Please sign in to comment.