This seems to be a simple question. I'm using pipes in my Ionic 2 application for dates format. This is the recieved webservice reponse.
[
{
"MessageID": 544882,
"CategoryID": 1,
"DateSent": "2015-05-18T02:30:56",
"Title": "Jobseeker App",
"MessageContent": "Hi Test guy just started to use the app..",
"Sender": null,
"Recipient": null,
"DateReceived": null,
"DateRead": "2015-05-18T02:30:56",
"Note_Direction": "sent",
"Viewed": 0,
"AppointmentDateTime": null,
"MessageAttachments": [
]
},
{
"MessageID": 544886,
"CategoryID": 1,
"DateSent": "2015-05-18T02:42:45",
"Title": "Jobseeker App",
"MessageContent": "App",
"Sender": null,
"Recipient": null,
"DateReceived": null,
"DateRead": "2015-05-18T02:42:45",
"Note_Direction": "sent",
"Viewed": 0,
"AppointmentDateTime": null,
"MessageAttachments": [
]}
]
This is the code snippet I'm using.
<div class="Date">
<label class="time">{{appointment.DateSent | date:"HH"}}:{{appointment.DateSent| date:"mm"}}</label>
<label class="month">{{appointment.DateSent| date:"MMM"}}</label>
<label class="day">{{appointment.DateSent| date:"dd"}}</label>
<label class="year">{{appointment.DateSent| date:"yyyy"}}</label>
</div>
Error:
Invalid argument '2015-05-18T02:30:56' for pipe 'DatePipe' in [{{appointment.DateSent | date:"HH"}}:{{appointment.DateSent| date:"mm"}} in AppointmentsPage@14:37]
I need to get a date format like this:
06:05
Dec
24
2015