madaneag
Junior Member
Posts: 5
Registered: 2/16/2005
Member Is Offline
|
| posted on 3/23/2005 at 09:58 PM |
|
|
how to customize time format?
can't seem to get the answer in your documentation
|
|
|
katAttack
Junior Member
Posts: 6
Registered: 6/3/2005
Member Is Offline
|
| posted on 6/3/2005 at 06:59 AM |
|
|
Not sure exactly what you want to do differently.... but if all you want to do is adjust the allowed entry characters, look at line:
re_tm = /^(\d{1,2})\:(\d{1,2})\:(\d{1,2})$/,
This sets the allowed characters and entry format ie HH:MM:SS
So if you wanted to allow only HH:MM
then:
re_tm = /^(\d{1,2})\:(\d{1,2})$/,
Then you have to check the validation function to ensure it is working the way you want:
by Default:
'time' : function validate_time(s_time) {
// check format
if (!re_tm.test(s_time))
return false;
// check allowed ranges
if (RegExp.$1 > 23 || RegExp.$2 > 59 || RegExp.$3 > 59)
return false;
return true;
}
It checks the value in HH (RegExp.$1) is a number <= 23, it also checks MM (RegExp.$2) is a number <=59 and SS (RegExp.$3) is also <=59.
So if you changed to remove the seconds you would change the line:
if (RegExp.$1 > 23 || RegExp.$2 > 59 || RegExp.$3 > 59)
to:
if (RegExp.$1 > 23 || RegExp.$2 > 59)
Thereby: removing the check for the 3rd part of the time value.
Get the general idea?
|
|
|
madaneag
Junior Member
Posts: 5
Registered: 2/16/2005
Member Is Offline
|
| posted on 6/10/2005 at 06:27 PM |
|
|
thanks
|
|
|