Im implements Ag Gird in Angular 2. I have a date column and date sorting, and the Ag grid expects the date type in format only. So I had to send it as a date for rendering. But my input is a string. I have a dateString in the format 2017-01-19. I do
let myDate:Date = moment(dateString).toDate();
But this givimg takes me out like Thu January 19, 2017 00:00 Indian Standard Time. I tried it too
let myDate:Date = moment(dateString).format("DD/MM/YYYY");
This gives me an error, the string is not assigned a Date.
Tried it too
let myDate:Date = moment(dateString,"DD/MM/YYYY");
But no luck. I want the type of output as date and in the form 01/19/2017
Please suggest
source
share