Lapenkov Vladimir
Lapenkov Vladimir

Reputation: 3218

jquery-globalize to get date and money in certain culture

I need to format date, number and money in a certain culture, which is stored on client side.

Is only globalize.js and cultures/globalize.culture.az.js and etc. enough or I should download any other scripts (download by NUGet from VStudio)

Please show examples of using it.

Upvotes: 0

Views: 363

Answers (2)

Lapenkov Vladimir
Lapenkov Vladimir

Reputation: 3218

To add date/time culture i need a bit injection in Globalize.js code `formatDate = function( value, format, culture ) { var cal = culture.calendar, convert = cal.convert, ret; if (!format || !format.length || format === "i") {

    if (culture && culture.name.length) {
        // {--begin inj
        ret = formatDate(value, cal.patterns.F, culture);
        return ret;
        // }--end inj

So I got rusults: var d = new Date(Date.UTC(2012,02,30)) Globalize.format(d,'','ru') "30 марта 2012 г. 3:00:00" Globalize.format(d,'','en')` "Friday, March 30, 2012 3:00:00 AM"

Upvotes: 0

Lapenkov Vladimir
Lapenkov Vladimir

Reputation: 3218

It seems I've dealed with this question. One need to put in layout and call the following: Globalize.format(val, "c2", language) for money

Upvotes: 0

Related Questions