Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for dd-mm-YYYY HH:ii:ss format

  • Loading branch information...
commit b64e46a63b312ed68a67c4058aaf3db6c0b4ece0 1 parent eaf483f
Juan José González authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 EDate.js
View
11 EDate.js
@@ -34,7 +34,7 @@ function EDate(date, UTC_by_default) {
var objDate = new Date();
var mapper_constructor = [
{
- 'pattern': /^\d\d-\d\d-\d\d\d\d$/i,
+ 'pattern': /^[0-2][0-9]|3[0-1]-0[1-9]|1[0-2]-\d{4}$/i,
'func' : function(date) {
var d = new EDate('',UTC_by_default);
d['set' + USEUTC + 'Date'](date.substring(0,2));
@@ -45,8 +45,13 @@ function EDate(date, UTC_by_default) {
}
},
{
- 'pattern': /^christmas$/i,
- 'func': function() {return new Date('2011-12-25');}
+ pattern: /^[0-2][0-9]|3[0-1]-0[1-9]|1[0-2]-\d{4} [0-1][0-9]|2[0-3]:[0-5][0-9]:[0-5][0-9]$/i,
+ func: function(date) {
+ var d = new EDate(date.substring(0,10), UTC_by_default);
+ console.debug(d);
+ d['set' + USEUTC + 'Hours'](date.substring(11,13),date.substring(14,16),date.substring(17,19),0);
+ return d;
+ }
},
{
'pattern': /yesterday/i,
Please sign in to comment.
Something went wrong with that request. Please try again.