This project is archived and is in readonly mode.

#536 open
Remko Nolten

Small Date.Parser enhancement

Reported by Remko Nolten | March 7th, 2011 @ 08:21 AM | in 1.4.0.1 (closed)

For a small framework we use, I was making a binding from the PHP IntlDateFormatter to the MooTools Date parser to created localized javascript datepickers. The date formats of the Locales inside PHP are defined by the ICU project (http://site.icu-project.org/), like this one: http://demo.icu-project.org/icu-bin/locexp?d=en&=nl_NL (the Dutch locale specification).

I noticed it was not possible to parse the output from the IntlDateFormatter with the Dutch locale since the ICU data correctly append a dot to the abbreviated month names, while the Date.Parser won't recognize this. This can be easily fixed by altering the regexOf function in MooTools More by allowing a dot at the end of each month/day:

var regexOf = function(type){
return new RegExp('(?:' + Date.getMsg(type).map(function(name){
    return name.substr(0, 3);
}).join('|') + ')[a-z]*\.?');
};

I think this will be a good enhancement, since I expect it will not break anything and allow the Date parser to conform more easily to the standards.

Comments and changes to this ticket

  • Arian

    Arian March 7th, 2011 @ 11:25 PM

    • State changed from “new” to “open”
    • Milestone set to 1.3.2.1
    • Assigned user set to “Arian”
    • Milestone order changed from “197577” to “0”

    I agree. For example 8 mrt. 2011 isn't recognized, however 8 mrt 2011 also fails. (mrt. is the Dutch abbreviation for March (for the non-Dutch people here :) ))

  • Arian

    Arian May 4th, 2011 @ 09:52 AM

    • Milestone changed from 1.3.2.1 to 1.4.0.1
    • Milestone order changed from “1” to “0”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Pages