Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: how to customize time format?
madaneag
Junior Member

Posts: 5
Registered: 2/16/2005
Member Is Offline
posted on 3/23/2005 at 09:58 PM Reply With Quote
how to customize time format?


can't seem to get the answer in your documentation
View User's Profile View All Posts By User U2U Member
katAttack
Junior Member

Posts: 6
Registered: 6/3/2005
Member Is Offline
posted on 6/3/2005 at 06:59 AM Reply With Quote

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?
View User's Profile View All Posts By User U2U Member
madaneag
Junior Member

Posts: 5
Registered: 2/16/2005
Member Is Offline
posted on 6/10/2005 at 06:27 PM Reply With Quote

thanks
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Free Download Free Download
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004