I simply want to create a date that is 3 days from now for use in a typescript angular component.
I have looked at Angular2 moment but this seems only to relate to pipes. Although I did see this article about using pipes in code, looks a bit hacky...
Maybe I'm missing something as this should be really simple?!
Thanks
date: Date;
ngOnInit() {
this.date = new Date();
this.date.setDate( this.date.getDate() + 3 );
}
Then you can use the date pipe to display the date nicely in your HTML
{{ date | date }}
Which renders thusly:
Sep 25, 2017