Created
January 6, 2023 20:01
-
-
Save javierd79/9390279d73573c1a4a66067b652c8f69 to your computer and use it in GitHub Desktop.
Prototype - setDays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Date { | |
setDays(days: number): Date | |
} | |
Date.prototype.setDays = function(days: number) { | |
const date = new Date(this.valueOf()) | |
date.setDate(date.getDate() + days) | |
return date | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment