How to set time range in time/date picker?
For example: user can pick only times between 8am anf 7pm.
Kind regards
Gregor
For example: user can pick only times between 8am anf 7pm.
Kind regards
Gregor
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
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
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]
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){[br][br]File location in my case is: {joomla root site}/libraries/cegcore2/cache/69c397d7a296016b971beced5e01ca84.js[br][br]Kind regards[br][br]Gregor
//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]);
}
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
Thank you!
This feature is now available in the core, you can set the open hours in the calendar field advanced settings.
Best regards
This topic is locked and no more replies can be posted.