Git Product home page Git Product logo

Comments (18)

LekisS avatar LekisS commented on June 3, 2024 54

@cvett try this:

import * as moment from 'moment';
import 'moment/min/locales';

moment.locale('fr-fr');

from ngx-moment.

olavocneto avatar olavocneto commented on June 3, 2024 8

@Yimiprod try

import * as moment from 'moment';
import * as locales from 'moment/min/locales';

moment.locale('fr-fr');

from ngx-moment.

mauricionarcizo avatar mauricionarcizo commented on June 3, 2024 4

Work!!
I did this:
import * as locales from 'moment/min/locales';

Thank you!

from ngx-moment.

Yimiprod avatar Yimiprod commented on June 3, 2024 3

@olavocneto it say cannot find module moment/min/locales even if the the path to this module exist.

Edit: After some research, it look like moment have a typescript file, who mess a little with the specs.
By the way, your doc ask us to do typings install --save moment who's not working anymore.

from ngx-moment.

WilldelaVega777 avatar WilldelaVega777 commented on June 3, 2024 1

I am using Ionic2 and have not been able to make it work, does anybody know how to change locales in a Ionic2 app?

from ngx-moment.

urish avatar urish commented on June 3, 2024

Did you try all lower-case? see #20

moment.locale('pt-br');

from ngx-moment.

mauricionarcizo avatar mauricionarcizo commented on June 3, 2024

Yes, I try and still don't translate.

from ngx-moment.

urish avatar urish commented on June 3, 2024

You may also need to load moment locales. See the following plunker for a working example:

http://plnkr.co/edit/Psu31oOcDf3RaHJIEwv5?p=preview

from ngx-moment.

urish avatar urish commented on June 3, 2024

thanks for sharing your solution :)

from ngx-moment.

Yimiprod avatar Yimiprod commented on June 3, 2024

Same problem as @WilldelaVega777 on an ionic 2 project.

import * as moment from 'moment';

moment.locale('fr-fr');

Does nothing

from ngx-moment.

victorcarvalhosp avatar victorcarvalhosp commented on June 3, 2024

Didn't worked here too...

from ngx-moment.

cyberbobjr avatar cyberbobjr commented on June 3, 2024

Same bug here : cannot find module moment/min/locales :(

from ngx-moment.

Yimiprod avatar Yimiprod commented on June 3, 2024

For ionic2 i had to create a fix in my app

app.ts

import './patch/moment';

patch/moment.ts

moment.locale('fr', { /* copy paste the local definition from the library */ }  as any);

from ngx-moment.

JacosNet avatar JacosNet commented on June 3, 2024

just load moment with locales only and it's working:

instead of: "{{PATH}}/moment/moment.js"
load: "{{PATH}}/moment/min/moment-with-locales.min.js"

from ngx-moment.

cvett avatar cvett commented on June 3, 2024

I have the Same Problem "cannot find module moment/min/locales" The solution not work.

from ngx-moment.

cvett avatar cvett commented on June 3, 2024

@LekisS Thanks its Works!

from ngx-moment.

Yimiprod avatar Yimiprod commented on June 3, 2024

@LekisS it works, thanks a lot.

from ngx-moment.

rodriguesgm avatar rodriguesgm commented on June 3, 2024

i've tried all these solutions in Ionic2 RC0, but it seems that it doesn't work.
I'm getting:
Error in ./TimeAgo class TimeAgo - inline template:0:6 caused by: Cannot read property 'humanize' of undefined
ORIGINAL EXCEPTION: Cannot read property 'humanize' of undefined

is there something else to do?
thanks

from ngx-moment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.