Hi im facing a weird issue here im getting dynamic data in that im also getting the date and time and im displaying it in html using date pipe in chrome/android it is working good but when i check ios/Safari it is showing time difference
below is my json data im consuming
FromCurrentDate: "2018-01-05T00:00:00"
FromPreviousDate: "2018-01-04T00:00:00"
ToCurrentDate: "2018-01-05T14:00:53.137"
ToPreviousDate: "2018-01-04T14:00:53.137"
im displaying the date like this and in chrome/android it is displaying like this
in Ios/safari it is displaying like this in the template im using the code below
Currrent {{singleTable[0].FromCurrentDate|date: 'dd/MM/yyyy,h:mm:ss a'}} to {{singleTable[0].ToCurrentDate|date: 'dd/MM/yyyy,h:mm:ss a'}}
how can i solve this time difference issue?
In ios/mac date filter doesn't work, so use moment.js for this.
I have tried lot of stuff but I was able to do best in moment.js
like: I created a pipe
<span>{{ActionDate | dateTimeFormatFilter : "MMM DD, YYYY"}}</span>
@Pipe({name: "dateTimeFormatFilter"})
@Injectable()
export class DateTimeFormatPipe implements PipeTransform {
transform(date: any, format: string): any {
if (date) {
return moment(date).format(format);
}
}
}