Home:ALL Converter>angularjs date timezone adjustment issue

angularjs date timezone adjustment issue

Ask Time:2017-04-17T13:41:05         Author:sunder

Json Formatter

What I want to do is print date in below format in angularjs.

Aug 30, 2016
{{CC.StartDate | date }} //angularjs UI code

I am just sending the modal with response, which will automatically deserialize object into json.

List<CClass> Items = CClass.GetMultipleAsObject(); //fetch data   
return Request.CreateResponse(Items); //sending it to UI

I can see that I am receiving "2016-08-30T00:00:00" in response in network tab. But when it gets rendered in different browser, it renders it differently.

I am in IST timezone, Chrome render it as "Aug 30, 2016". But IE and FF render it as "Aug 29, 2016". In PST timezone all browser render it correct. Date looks like in UTC.

I tried converting it into a plain string, still same issue. Tried this - $filter('date')(input, "yyyy-MM-dd");, still same issue

I haven't tried momentjs, thought it must be possible without that also.

Can someone guide, how I can I get rid of this timezone localization and just show date in string ire-respective of timezone?

Author:sunder,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43445777/angularjs-date-timezone-adjustment-issue
yy