I have a date string, like this 1987-06-15T00:00:00.000Z, when I am added date pipe on it the date is showing a different date like Jun 14, 1987 in American time zone, but in India, it's showing correct.
<div>{{'1987-06-15T00:00:00.000Z' | date}}</div>
DatePipe is used to format a date value according to locale rules. Syntax: {{ value | date }} Approach: Create the angular app that to be used. There is no need for any import for the DatePipe to be used.
The string 1987-06-15T00:00:00.000Z represents different dates in different browser time zones.
If you don't want to change the date based on time zone, just use string parsing (e.g. substr) and not date parsing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With