ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Chronoforms 6 - Time limits

gberlisk 21 Dec, 2017
How to set time range in time/date picker?
For example: user can pick only times between 8am anf 7pm.

Kind regards

Gregor
Max_admin 27 Dec, 2017
Hi Gregor,

You can set the start/end dates, but I did not try to set the time before, did you try to include the time in those fields ?

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
gberlisk 27 Dec, 2017
Hi Max,

I've tried but it didn't work and it can't work. I've checked the code and found this:

[pre]$.G2.boot.calendar = function(Container){
//calendar
Container.find('[data-calendar]').each(function(i, calfield){
var mindate = null;
if($(calfield).data('mindate')){
var parts = $(calfield).data('mindate').split('-');
var mindate = new Date(parts[0], parts[1]-1, parts[2]);
}
var maxdate = null;
if($(calfield).data('maxdate')){
var parts = $(calfield).data('maxdate').split('-');
var maxdate = new Date(parts[0], parts[1]-1, parts[2]);
}[/pre]

First, the problem is delimiter "-" wihich is only used for date.[br]Second, new Date() is having only 3 parameters (for date).[br][br]So, if anyone need to work this, has to change te code. My code probably is not optimal but it works for my needs. I'm not using seconds in time.[br]This is my code:[br][br]
$.G2.boot.calendar = function(Container){
//calendar
Container.find('[data-calendar]').each(function(i, calfield){
var mindate = null;
if($(calfield).data('mindate') && $(calfield).data('type') == 'time'){
var parts = $(calfield).data('mindate').split(':');
var mindate = new Date(0, 0, 0, parts[0], parts[1], 0);
} else if($(calfield).data('mindate')){
var parts = $(calfield).data('mindate').split('-');
var mindate = new Date(parts[0], parts[1]-1, parts[2]);
}
var maxdate = null;
if($(calfield).data('maxdate') && $(calfield).data('type') == 'time'){
var parts = $(calfield).data('maxdate').split(':');
var maxdate = new Date(0, 0, 0, parts[0], parts[1], 0);
} else if($(calfield).data('maxdate')){
var parts = $(calfield).data('maxdate').split('-');
var maxdate = new Date(parts[0], parts[1]-1, parts[2]);
}
[br][br]File location in my case is: {joomla root site}/libraries/cegcore2/cache/69c397d7a296016b971beced5e01ca84.js[br][br]Kind regards[br][br]Gregor
Max_admin 17 Feb, 2018
Hi Gregor,

Thank you!

This feature is now available in the core, you can set the open hours in the calendar field advanced settings.

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com