Skip to content

Commit ff705a9

Browse files
authored
Create next-day.ts
1 parent 118e803 commit ff705a9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

TypeScript/next-day.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Time: O(1)
2+
// Space: O(!)
3+
4+
declare global {
5+
interface Date {
6+
nextDay(): string;
7+
}
8+
}
9+
10+
Date.prototype.nextDay = function() {
11+
return new Date(this.getTime() + 24 * 60 * 60 * 1000).toISOString().split("T")[0];
12+
}

0 commit comments

Comments
 (0)