mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 22:43:47 +01:00
Mootools/more : Added date format parameter to Date::Parse() method (propose on github https://github.com/mootools/mootools-more/pull/255)
This commit is contained in:
parent
0c404082fd
commit
de2336f68e
1 changed files with 2 additions and 2 deletions
|
@ -1174,7 +1174,7 @@ Date.extend({
|
||||||
return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
|
return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
parse: function(from){
|
parse: function(from,format){
|
||||||
var t = typeOf(from);
|
var t = typeOf(from);
|
||||||
if (t == 'number') return new Date(from);
|
if (t == 'number') return new Date(from);
|
||||||
if (t != 'string') return from;
|
if (t != 'string') return from;
|
||||||
|
@ -1182,7 +1182,7 @@ Date.extend({
|
||||||
if (!from.length) return null;
|
if (!from.length) return null;
|
||||||
|
|
||||||
var parsed;
|
var parsed;
|
||||||
parsePatterns.some(function(pattern){
|
((format) ? [build(format)] : parsePatterns).some(function(pattern){
|
||||||
var bits = pattern.re.exec(from);
|
var bits = pattern.re.exec(from);
|
||||||
return (bits) ? (parsed = pattern.handler(bits)) : false;
|
return (bits) ? (parsed = pattern.handler(bits)) : false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue