Last active
May 4, 2020 23:27
-
-
Save umutyerebakmaz/d00dbd6f6a5c6f0548b2f5a24d96ab2d to your computer and use it in GitHub Desktop.
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
export class LocaleDateModule { | |
options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; | |
constructor() { } | |
getFutureDate(nextDay: number, locale: string, options: any): string { | |
const today = new Date(); | |
const future = new Date(today); | |
future.setDate(future.getDate() + nextDay); | |
const string = new Date(future).toLocaleDateString(locale, options); | |
console.log(string); // 17 Mayıs 2020 Pazar | |
return string; | |
} | |
showDate() { | |
return this.getFutureDate(15, 'tr-TR', this.options); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment