Giter Site home page Giter Site logo

Comments (9)

lifewithcats avatar lifewithcats commented on May 15, 2024

Changing "eras" property like following made it work fine:
{ "name": "平成", "start": new Date("1989/1/8").getTime(), "offset": 1988 },
{ "name": "昭和", "start": new Date("1926/12/25").getTime(), "offset": 1925 },
{ "name": "大正", "start": new Date("1912/7/30").getTime(), "offset": 1911 },
{ "name": "明治", "start": new Date("1968/9/8").getTime(), "offset": 1867 }

from globalize.

blq avatar blq commented on May 15, 2024

seems to work, thanks!

from globalize.

rdworth avatar rdworth commented on May 15, 2024

A different fix is needed as this one is not compatible with the specification for eras. See jquery.global.js lines 429-435

            eras: [
                // eras in reverse chronological order.
                // name: the name of the era in this culture (e.g. A.D., C.E.)
                // start: when the era starts in ticks (gregorian, gmt), null if it is the earliest supported era.
                // offset: offset in years from gregorian calendar
                { "name": "A.D.", "start": null, "offset": 0 }
            ],

from globalize.

rdworth avatar rdworth commented on May 15, 2024

Also, see http://www.i18nguy.com/l10n/emperor-date.html the start of 明治 is 1868/9/8 not 1968/9/8

from globalize.

lifewithcats avatar lifewithcats commented on May 15, 2024

Thank you for the indications.

from globalize.

lifewithcats avatar lifewithcats commented on May 15, 2024

Here's correct values:
{ "name": "平成", "start": new Date("1989/1/8").getTime(), "offset": 1988 },
{ "name": "昭和", "start": new Date("1926/12/25").getTime(), "offset": 1925 },
{ "name": "大正", "start": new Date("1912/7/30").getTime(), "offset": 1911 },
{ "name": "明治", "start": new Date("1868/9/8").getTime(), "offset": 1867 },
{ "name": "西暦 '", "start": null, "offset": 0 }

from globalize.

rdworth avatar rdworth commented on May 15, 2024

Thanks for your help. Next step is a QUnit test (see /tests/ folder) that fails with the current values and passes with the new values. There should be at least one test for each era.

from globalize.

lifewithcats avatar lifewithcats commented on May 15, 2024

Thank you again for instruction.
But testing format and parse date part (test/parse.js lines 43-49) is not complete...

from globalize.

rxaviers avatar rxaviers commented on May 15, 2024

Globalize 1.x doesn't support Japanese calendar (regression). If you need such support, please weigh in #320. I'm closing this issue in favor of #320 to help focus our efforts. Also, note the new implementation is going to use CLDR data and potentially new code as well.

from globalize.

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.