setDate
Commons
stable
Return a new Date with the day-of-month replaced by the given value. The original date is never mutated.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- daterequisDate
- The source date. It is cloned before the day is updated.
- dayrequisnumber
- The day-of-month to set (1–31). Values outside the month range are normalised by the JS Date constructor.
API
Valeur de retour
La valeur retournée par cet util.
- A new Date object with the specified day-of-month.
Usage
Exemples
Extraits de code prêts à coller.
Change the day while keeping month and year