My Laravel 5 API pulls regular datetime columns from my MySQL db. My JSON datetime output looks like this:
2015-08-13 13:45:00
but the widget reading my JSON expects a JavaScript Date Object? What would be the syntax to pass my datetime as a JavaScript Date Object?
My current Laravel method looks like so:
public function transform($events)
{
return [
'startdt' => $events['event_start'],
'enddt' => $events['event_end'],
];
}
This is the code I have in my widget JS file:
'use strict';
angular
.module('demo', ['mwl.calendar', 'ui.bootstrap', 'ngTouch', 'ngAnimate'])
.controller('MainCtrl', function ($modal, moment, $http) {
var vm = this;
vm.calendarView = 'month';
vm.calendarDay = new Date();
$http.get('http://ift.tt/1Wnooc0').success(function(events) {
vm.events = events.events;
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire