robee29
Newbie
Posts: 1
Registered: 2/16/2005
Member Is Offline
|
| posted on 2/16/2005 at 09:21 AM |
|
|
how to customize date format to MM/DD/YYYY
I've searched this forum and the documentation page..so it said that the date format is customizable..if so, how can I do it???
|
|
|
madaneag
Junior Member
Posts: 5
Registered: 2/16/2005
Member Is Offline
|
| posted on 2/16/2005 at 03:55 PM |
|
|
i faced the same problem today
try this
in validator.js
change
re_dt = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/
'date' : function (s_date) {
// check format
if (!re_dt.test(s_date)){
return false;
}
// check allowed ranges
if (RegExp.$1 > 12 || RegExp.$2 > 31){
return false;
}
// check number of day in month
var dt_test = new Date(RegExp.$3, Number(RegExp.$1-1), RegExp.$2);
if (dt_test.getMonth() != Number(RegExp.$1-1))
return false;
return true;
}
|
|
|
katAttack
Junior Member
Posts: 6
Registered: 6/3/2005
Member Is Offline
|
| posted on 6/3/2005 at 05:45 AM |
|
|
Important think to note, there are two issues being dealt with in the example above.
1] The use of a Slash '/' instead of the default hyphen '-'
2] Change from DDMMYYYY to MMDDYYYY
So if you only want to change entry format to allow a slash instead of a hyphen they only change the line:
re_dt = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
|
|
|