I am using bootstrap-datetimepicker and using ISO8601 datetime format as yyyy-mm-ddThh:ii:ssZ
as mentioned in their options section
In my controller, I do
transaction.date = $('.form_datetime input').val();
which sends the data to backend as (console.log)
created_on: "Wed, 08 May 2013 23:18:32 -0000"
and saves in database as
2013-05-08 16:18:32-07
In my template, I do
<td>{{ transaction.created_on | date:'medium'}}</td>
and I see the output on my HTML as
Wed, 08 May 2013 23:18:32 -0000
But as per the Angular doc, it should be for format Oct 28, 2010 8:40:23 PM
What is that I am missing?
I don't understand why no one provided the simple answer of using the correct format in the filter?
That will format as ISO-8601
Beside all this, just you have change like this,
try to wirte it as
For now, I have created a filter
added as dependency in
app.js
asand in
HTML
used it asand that presents date on
HTML
asIf you know a better idea, please let me know
In Brazil (and most of Europe, Australia, etc.), we use the default MySQL DATETIME on DB's:
But use date() to display it like this:
So in order to display that date in angular, "correctly", create a filter:
Then, on your angular app, just call the filter and format the value for display:
That covers date format in Brazilian, UK, New Zealand, etc. date format for angular, just subtract the timezone correctly.