Reputation: 1039
I am doing some validation in angular where date added by user has to be greater than some other date on form.
On dateChange on input:From, i call this method which check for validation but when i try to get the date entered, it get date in US version.
ex:
var from = new Date(viewValue);
viewvalue is "08/04/2016" but from comes out as 'Thu Aug 04 2016 00:00:00 GMT+0100 (GMT Daylight Time)'
What can i do so that from comes out as April 8th ?
Thanks.
Upvotes: 1
Views: 46
Reputation: 1243
I suggest you to use Momentjs:
var from = new Date(viewValue);
var date = moment(from).format('MMM Do');
Upvotes: 2