parseLocalDate
Calendar
stable
Parse a `"YYYY-MM-DD"` string into a local-time `Date` by splitting on `-` and passing individual components to `new Date()`. This avoids the UTC offset that the single-argument `new Date(string)` constructor introduces.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- valuerequisstring
- A `"YYYY-MM-DD"` date string. The components are split and passed as separate numeric arguments to `new Date()` to force local time zone.
API
Valeur de retour
La valeur retournée par cet util.
- A `Date` set to midnight in the user's local time zone. Avoids the off-by-one-day bug that `new Date("YYYY-MM-DD")` triggers when the timezone offset is negative.
Usage
Exemples
Extraits de code prêts à coller.
Parse a date without timezone shift