Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@umutyerebakmaz
Last active May 4, 2020 23:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umutyerebakmaz/d00dbd6f6a5c6f0548b2f5a24d96ab2d to your computer and use it in GitHub Desktop.
Save umutyerebakmaz/d00dbd6f6a5c6f0548b2f5a24d96ab2d to your computer and use it in GitHub Desktop.
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