Git Product home page Git Product logo

Comments (8)

fingerpich avatar fingerpich commented on May 30, 2024 3

I will fix it in next version
but for now you can cast and use it

(moment().localeData() as any)._jMonths.slice(0);

from jalali-moment.

fingerpich avatar fingerpich commented on May 30, 2024

Hi,
What is the problem with the following code?

moment.locale('fa').format('jMMMM');

from jalali-moment.

peymanebrahimi avatar peymanebrahimi commented on May 30, 2024

As you helped me with this nice and concise function of returning weekDayNames:

    getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {
        switch (style) {
            case 'long':
                return jmoment().localeData().weekdays().slice(0);
            case 'short':
                return jmoment().localeData().weekdaysShort().slice(0);
            case 'narrow':
                return jmoment().localeData().weekdaysMin().slice(0);
        }
    }

Is there any similar way to returning months name?
I need a consistent way, by calling localeData()
return jmoment().localeData().months().slice(0); // must return Persian names

from jalali-moment.

fingerpich avatar fingerpich commented on May 30, 2024

Hi,
you could use the following code

moment().localeData()._jMonths.slice(0);
moment().localeData()._jMonthsShort.slice(0);
moment().locale('fa').localeData()._jMonths.slice(0);

from jalali-moment.

peymanebrahimi avatar peymanebrahimi commented on May 30, 2024

no such functions or properties in typescript.
_jMonths is not available on localeData()

from jalali-moment.

peymanebrahimi avatar peymanebrahimi commented on May 30, 2024

Thank you very much. nice of you as always

from jalali-moment.

AsefDaqiq avatar AsefDaqiq commented on May 30, 2024

how can i change the names of the months to Afghanistan's month? is there any way to achieve this functionality?

from jalali-moment.

fingerpich avatar fingerpich commented on May 30, 2024

You can find it in the moment documents
https://www.tutorialspoint.com/momentjs/momentjs_customization_month_names.htm

from jalali-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.