Search code examples
angularjsbootstrap-datetimepicker

Convert Bootstrap Datepicker Date Using Angular Date filter


I have the following date being returned from my datepicker:

Date {Thu Oct 22 2015 00:00:00 GMT+0000 (GMT Standard Time)}

I am trying to use angularjs's $filter to format it the way i want but it does not appear to be working, is there a way around this?:

 $filter('date')(new Date($scope.form.date + ' ' + ticket.departure_time, "mediumDate"));

Solution

  • Ended up having to download and integrate DateJS. I then did this to achieve what i wanted:

    var ticket_date =  Date.parse($scope.form.date).toString('MMM dd, yyyy');
    var ticket_time = Date.parse(ticket.departure_time).toString('hh:mm tt');