# Moment js and date pipe

**URL:** <https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749>\
**Category:** ionic-v3\
**Created:** [July 20, 2018, 7:48am UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749 "2018-07-20T07:48:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HinderiksR](https://avatars.discourse-cdn.com/v4/letter/h/9dc877/32.png) [@HinderiksR](https://forum.ionicframework.com/u/HinderiksR)\
**Post date:** [July 20, 2018, 7:48am UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749/1 "2018-07-20T07:48:56Z")

</div>

Hi,

I’m trying to use the date pipe from angular (5) which i believe uses moment js. We already use moment in a component which works fine, when a user logs in we bind its language to moment.locale. However the date pipe does not seem to use this setting. Also i tried using a datePipeProxy which initialises a new date pipe with the correct language but it says it does not support ‘nl’ as a locale.

Does anybody have any ideas ?

With best regards,  
Robin

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 20, 2018, 7:44pm UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749/2 "2018-07-20T19:44:07Z")

</div>

> [@HinderiksR](#):
>
> I’m trying to use the date pipe from angular (5) which i believe uses moment js.

No, it doesn’t.

> [@HinderiksR](#):
>
> it says it does not support ‘nl’ as a locale.

Angular by default only has the en\_US locale. You need to add other ones yourself. See [the Angular i18n docs](https://angular.io/guide/i18n).

---

<div class="post-metadata">

**Author:** ![HinderiksR](https://avatars.discourse-cdn.com/v4/letter/h/9dc877/32.png) [@HinderiksR](https://forum.ionicframework.com/u/HinderiksR)\
**Post date:** [July 23, 2018, 6:28am UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749/3 "2018-07-23T06:28:56Z")

</div>

Thanks, I dont know why i thought the date pipe used moment js.

Since i need to change translations on the go i opted for a custom pipe which does use moment.js. Their are some work around available for changing the date pipe translation on the go but i really like moment js so i opted for that instead.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 23, 2018, 8:20am UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749/4 "2018-07-23T08:20:22Z")

</div>

> [@HinderiksR](#):
>
> i really like moment js

I used to too, but now I consider [date-fns](https://date-fns.org/) to be vastly superior. It is much more lightweight and works on either ISO8601 strings or JavaScript `Date`s, instead of needing the unwieldy moment object, which makes dealing with dates coming across the network much simpler. Fellow forum poster @AaronSterling has also made [a set of date pipes that work with it](https://github.com/Aaron-Sterling/ng-datefns-pipes).

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:29pm UTC](https://forum.ionicframework.com/t/moment-js-and-date-pipe/135749/5 "2021-07-19T21:29:10Z")

</div>


