Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

amDateFormat showing formatted dates of day before when using with moment-timezone #293

Open
Jaspur opened this issue Jul 18, 2017 · 0 comments

Comments

@Jaspur
Copy link

Jaspur commented Jul 18, 2017

Code:

<div class="the-date" ng-title="energy.date">
    <h5>{{ energy.date | amDateFormat:'dddd' }}</h5>
    <h4>{{ energy.date | amDateFormat:'D MMMM YYYY' }}</h4>
</div>

Result:
schermafdruk 2017-07-18 21 55 32

It's 1990-04-30, but it shows via amDateFormat 29 april 1990. So an incorrect date. Same for the day; it shows "zondag" (Sunday), but it should be Monday.

Timezone is configured correctly:

app.constant('angularMomentConfig', {
    timezone: 'Europe/Amsterdam'
});

When I run it via the default moment()-function like this:

console.info(energy.date);
console.info(moment(energy.date));

It's showing it correctly:
schermafdruk 2017-07-18 22 02 52

It happens by multiple dates in the past, so is it a bug in the amDateFormat somewhere?
When I remove moment-timezone as a dependency it shows it all correctly.. Why is this?

@Jaspur Jaspur changed the title amDateFormat shows previous day of date amDateFormat shows previous day of date while moment() does it correct Jul 18, 2017
@Jaspur Jaspur changed the title amDateFormat shows previous day of date while moment() does it correct amDateFormat showing formatted dates of day before when using with moment-timezone Jul 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant