I am using the AngularJS Datepicker for a project. When posting a date I succeed on getting data back but the problem is that I get the date in the format of 2018-05-23T06:00:00.000Z.
Is there a way to get it to show just 2018-05-23?
This is what I have as my current datepicker
// Date picker
$scope.myDate = new Date();
$scope.minDate = new Date(
$scope.myDate.getFullYear(),
$scope.myDate.getMonth() - 2,
$scope.myDate.getDate());
$scope.maxDate = new Date(
$scope.myDate.getFullYear(),
$scope.myDate.getMonth() + 2,
$scope.myDate.getDate());
$scope.onlyWeekdaysPredicate = function (date) {
var day = date.getDay();
return day === 1 || day === 2 || day === 3 || day === 4 || day === 5;
};
This is my HTML
<md-input-container style="margin:0px;position:relative;right:15px;font-size:15px">
<md-datepicker ng-model="user.next_class" ng-model="myDate" md-placeholder="Pick a date" md-date-filter="onlyWeekdaysPredicate" date:"MM/dd/yyyy 'at' h:mma" md-open-on-focus></md-datepicker>
</md-input-container>
I have heard of using Moment.JS for this and currently trying to find a resource that may help.