This project is archived and is in readonly mode.

#513 open

Specific parser of Date not taken in account

Reported by KalNex | February 16th, 2011 @ 10:15 AM | in (closed)


I want to use a specific parser, I define it in Date class using Date.defineParser(...) method but I noticed that my parser was put on parsePatterns variable at the end of the list. When I want to parse a date (date.parse(...)) the method take another parser because it test it before mine.
The parser '%x( %X)?' match with my pattern before mine, but it sometimes invert month with day... (this parser is an exemple, others can also interfer)

I found a solution in modify the Date.defineParser(...) method :

defineParser: function(pattern){

parsePatterns.unshift(( && pattern.handler) ? pattern : build(pattern));


I replace the push in parsePatterns by a unshift (it put to the first place the new parser).

But I don't want to modify MooTools More source, this modification can be taken in account for a next release ?

MooTools More

Comments and changes to this ticket

  • Arian

    Arian February 16th, 2011 @ 03:53 PM

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

    I personally think adding a second argument to Date.parse where you can manually set a pattern would be the best solution.
    Using .unshift might work for you, but it doesn't really solve the problem, it just changes it a bit.

  • Arian

    Arian February 25th, 2011 @ 08:15 PM

    • Milestone changed from to
    • Milestone order changed from “53” to “0”
  • Benjamin Renard

    Benjamin Renard June 27th, 2011 @ 10:52 AM


    I implemented Arian solution of second parameter :

    It shoud be merged soon.

  • SchizoDuckie

    SchizoDuckie November 13th, 2011 @ 10:19 PM

    Guys, Please finally implement this.
    It's driving people away from mootools, since it makes working with european date formats is becoming a nightmare, especially incombination with one of the otherwise excellent datepickers out there, this should be a breeze in Mootools and this bug has been open since 2010. (See bug #1100 in Mootools.Core)

    IMO the options by Benjamin Renard should be implemented asap.

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