vendredi 29 janvier 2016

Laravel 5.1 format date array for chart.js data

Apologies, I can't upload my controller code right now but I'm hoping you can help with the info I can give you.

I'm using chart.js to plot a line graph of data. I'm passing the values from my controller for the data points and the date that matches the date point.

In my view I'm receiving the following array from the controller:

["2015-06-01","2015-05-01","2015-04-01","2015-03-01","2015-02-01","2015-01-01"]

Which is then being encoded into JSON. Now, should I be attempting to format the date into something a bit more readable inside the controller or inside the view?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire