-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utc to local #160
Comments
Here is the right code in file node_modules/angular2-moment/local.pipe.js So it must be |
Try updating to the newest version of this package and give |
I tried {{'2017-09-07T00:14:47' | amFromUtc | amLocal | amDateFormat: 'YYYY-MM-DD'}} after taking latest version. It still returns 2017-09-07. Although if I try {{'2017-09-07T00:14:47Z' | amFromUtc | amLocal | amDateFormat: 'YYYY-MM-DD'}} [NOTICE 'Z' in datetime] I am not sure if 'Z' must be appended at the end to UTC datetime or this library API can be updated to convert by appending 'Z' automatically. ASP.NET WEB API does not return time appended with 'Z' |
I tried using native moment and it seemed to work without the 'Z' ( |
As I mentioned in my initial post, I am in PST time zone. '2017-09-07T00:14:47' is in UTC. On converting it to PST timezone, the date should be 2017-09-06 [ http://coderstoolbox.net/unixtimestamp/ ]. @ What happens if you just do {{ '2017-09-07T00:14:47' | amFromUtc | amDateFormat }}? Could you please point out what am I doing incorrectly? |
I just tried from a blank angular project generated with the CLI and it gave the expected results in the Eastern timezone. What does |
@ What does {{ '2017-09-07T00:14:47' | amFromUtc | amLocal | amDateFormat }} output? What was the output when you tried on a blank angular project for '2017-09-07T00:14:47' in Eastern Time Zone? The expected result should be 2017-09-06 as EST is 4 hrs behind to UTC. |
That is the output that I got when I tried it in Eastern timezone. Could you try in a blank project? It seems as though you are doing everything correct |
Did you search for duplicate issue? Yes
I have utc date/time [2017-09-07T00:14:47]. I am in PST zone. The equivalent local date [PST] should be 2017-09-06 but pipe amLocal shows 2017-09-07.
below is the code -
{{'2017-09-07T00:14:47' | amUtc | amLocal | amDateFormat: 'YYYY-MM-DD'}}
This time is returned by ASP.NET WebAPI.
Am I doing something incorrectly? Could you please guide me?
Plunker - http://plnkr.co/edit/sJlX7SpLwY7QPaDeqDUx?p=preview
The text was updated successfully, but these errors were encountered: