setMonth
Commons
stable
Return a new Date with the month replaced by the given zero-based index (0 = January). 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 month is updated.
- countrequisnumber
- Zero-based month index (0 = January … 11 = December). Values outside 0–11 roll over into adjacent years.
API
Valeur de retour
La valeur retournée par cet util.
- A new Date object with the specified month.
Usage
Exemples
Extraits de code prêts à coller.
Switch to a different month