I'm using angular-ui-datepicker popup and I'm trying to persist the saved date value as a string with the date only. M/d/yyyy
The input after date selection is correct 5/11/2015
but the value stored is a Date
Mon May 11 2015 00:00:00 GMT-0400 (Eastern Daylight Time) 12:00AM
Is there a way to always store the value as the date string
and not as a Date
object?
<p class="input-group">
<input type="text" datepicker-popup="M/d/yyyy" ng-model="event.date"
is-open="datePickers['date']" class="form-control" />
<span class="input-group-btn">
<button type="button" class="btn btn-default"
ng-click="toggleDatepicker('date', $event)">
<i class="fa fa-calendar"></i>
</button>
</span>
</p>
In the above case I need the data to always be the date string, for instance:
{
date: '5/11/2015'
}
and not
{
date: `Mon May 11 2015 00:00:00 GMT-0400 (Eastern Daylight Time) 12:00AM`
}