[Fixed] Angular 9 DatePipe: How to ignore timezone format


I am currently using angular 9 DateTime Pipe in order to format my dateTimes.
I am storing the dateTimes in database with DataTimeOffset.
When I am retrieving this dates from server are in this form: "2021-03-30T16:26:52.047+02:00"

I am using this code to apply the format to my dates:

const pipe = new DatePipe('en-Us);
const formatedDate = pipe.transform(date, 'dd.MMM.yyyy HH:mm:ss');

When I am doing this, the pipe is taking the browser time and format my date.
I know that this is the default option, if I am not sending the 3rd parameter to the transform function.

But I have a business need to show the dates as they are…but formatted in the format mentioned above,

My question is: How can I avoid the timeZone convert but still format the dateTime?


After many days of investigation, the only workaround was to use the library "Luxon".


With this library I can do something like this:

var keepOffset = DateTime.fromISO("2017-05-15T09:10:23-09:00", { setZone: true });

Which will keep the offset intact.

Leave a Reply

(*) Required, Your email will not be published