Code Monkey home page Code Monkey logo

Comments (3)

bigman73 avatar bigman73 commented on June 11, 2024

I extended the current module like so, with a 'P' token:
dateAndTime.setLocales('en', {
P: ['AM', 'PM'],
formatter: {
P: function (d/, formatString/) { return this.P[d.getHours() > 11 | 0]; }
}
});

It works but:

  1. Why not have this very common logic as part of the core logic?
  2. AA cannot work due to the regular expression in the date.format. It is parsed as a double 'A' token

The regular expression there needs to support AA|A as alternations in that order

from date-and-time.

knowledgecode avatar knowledgecode commented on June 11, 2024

The a.m./p.m. or AM/PM are English expressions. So this is a problem specific to English. We plan to solve it with sort of an extension kit in the future version.

from date-and-time.

knowledgecode avatar knowledgecode commented on June 11, 2024

Quite a long time has been passed, we have finally introduced a plugin system to this library, and released a plugin of AA token you suggested before as one of the official plugins.

from date-and-time.

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.