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: Setting default time values
garlinx
Junior Member

Posts: 3
Registered: 10/12/2009
Member Is Offline
posted on 10/12/2009 at 12:04 PM Reply With Quote
Setting default time values


Congrats on an excellent tool which works very well.

I do however require some help with the following:

I have a form with two input fields i.e. startDate and endDate.

I am trying my best to customise the calendar_db.js script to enable the tigra calendar to automatically attach the time 00:00 to the startDate e.g. 2009-10-01 00:00 and the time 23:59 to the endDate e.g. 2009-10-31 23:59, but unfortunately without any success.

Would be very thankful for at least a tip in the right direction.

EDIT:

I have been able to enable the tigra calendar to pass a single default 00:00 to the selected date as follows:

function f_tcalGenerDate (d_date) {
return (
d_date.getFullYear() + "-"
+ (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ " 00:00" // THIS LINE ADDED BY GARLINX!!
);
}

but this applies unfortunately to both input fields i.e. both startDate and endDate.
View User's Profile View All Posts By User U2U Member
garlinx
Junior Member

Posts: 3
Registered: 10/12/2009
Member Is Offline
posted on 10/13/2009 at 03:18 PM Reply With Quote

Hi again.

Am unfortunately still battling with this problem. :(

Is there any way that this can be achieved?

Or maybe it is simply not possible...

Many thanks.
View User's Profile View All Posts By User U2U Member
garlinx
Junior Member

Posts: 3
Registered: 10/12/2009
Member Is Offline
posted on 10/14/2009 at 10:15 PM Reply With Quote

OK. I think I have found the solution to my problem.

It was necessary to expand the function f_tcalGenerDate() in the calendar_db.js file as follows:

// date generating function
function f_tcalGenerDate (d_date) {

if (this.a_cfg.controlname == 'startDate') {
return (
d_date.getFullYear() + "-"
+ (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ " 00:00"
);
}
else if (this.a_cfg.controlname == 'endDate') {
return (
d_date.getFullYear() + "-"
+ (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
+ (d_date.getDate() < 10 ? '0' : '') + d_date.getDate()
+ " 23:59"
);
}
}

where my two input boxes are named startDate and endDate respectively.


I also had to expand the accepted regular expression in the function f_tcalParseDate()
from
var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*$/; // e.g. YYYY-MM-DD
to
var re_date = /^\s*(\d{2,4})\-(\d{1,2})\-(\d{1,2})\s*(\d{1,2})\:(\d{1,2})\s*$/; // e.g. YYYY-MM-DD HH:MM


Please forgive any potential errors or bugs in the above - I have next to no knowledge of Javascript.. :)
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Tigra Calendar
Product Demonstrations Live Demos
Free Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 
Tigra Calendar PRO
Product Demonstrations Live Demos
Popup Calendar
Onpage Calendar
Modal Calendar
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


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