Forums

Mootools DateTime Picker - how to exclude days of the week

Fruitloopy 05 Dec, 2012
Hi

I have created a booking form which will allow people to book a table at a restaurant. The restaurant is closed on Mondays so I would like to exclude this day.
I cant find any info to exclude a day on Google.

I am using Mootools date/time picker with Vista style.

Any suggestions?

Thanks
Fruitloopy 06 Dec, 2012
Hi Greyhead

Thanks for the response. Call me dumb but I cant get my head around that syntax and how to implement it within the "DateTime Picker Config" field.

I have this in the field at the moment to prevent earlier dates being selected previous to today+1:

minDate: new Date().increment('day', 1)

This works fine. I just dont know what to put next to prevent Mondays being selected.

Thanks.
Fruitloopy 07 Dec, 2012
After reading the GITHUB page I replaced the components/com_chronoforms/js/datepicker_moo/Picker.Date.js with the new one.

I have changed the code to the below to try to exclude Mondays and only allow today + 1 to be selected but nothing works.

I know I have got it wrong but can someone help please?

(function(){

this.DatePicker = Picker.Date = new Class({

	Extends: Picker.Attach,

	options: {/*
		onSelect: function(date){},

		minDate: new Date().increment('day', 1), // Date object or a string
		maxDate: new Date('3/4/2011'), // same as minDate
		availableDates: {}, //
		invertAvailable: false,
		weekdays: [0, 2, 3, 4, 5, 6], // null allows all days, a subset of [0, 1, 2, 3, 4, 5, 6] allows only selected days e.g [0, 6] allows Saturday and Sunday only

		format: null,*/

		timePicker: false,
		timePickerOnly: false, // deprecated, use onlyView = 'time'
		timeWheelStep: 15, // 10,15,20,30


Thanks

If you want to have a look please visit http://fruitloopy.com/index.php/menus-bookings/booktable
GreyHead 07 Dec, 2012
Hi fruitloopy,

You don't need to edit the Picker.Date.js file so please undo any changes to that.

Your form needs to be using the MooTools DatePicker - see the setting on the Forms General tab.

Then add weekdays: [0, 2, 3, 4, 5, 6], to the DatePicker options either on the General tab or using the Custom MooTools DatePicker action.

Bob
treblesix 04 Jan, 2013
Hi Bob

I am looking to implement this option too but cannot get your solution to work - am I missing the obvious? I have the following in the Datetime picker config field

format: '%A %d %B %Y',startView: 'months',minDate: new Date().increment('day', 1),weekdays: [0, 2, 3, 4, 5, 6],

Everything works except the weekday option - is there something wrong here?

Any help appreciated
GreyHead 05 Jan, 2013
Hi treblesix,

I'm not clear, have you downloaded and installed the modified files from my GitHub page?

Bob
treblesix 06 Jan, 2013
Thanks Bob - just checked and had updated wrong files - works fine now thanks for the help
Fruitloopy 10 Jan, 2013
I copied over the changed files from the GITHUB page and added the following entries to the Date Time Picker Config field:
format:'%d-%m-%Y', weekdays: [0, 2, 3, 4, 5, 6], minDate: new Date().increment('day', 1)

and the exclusion of Monday now works, thank you.

I have another problem though:
I cant find the correct syntax for selecting the time. Because I have a restaurant table booking form I would like customers to select a date and then a time in two separate fields:

As above, I have added the date format I want but if I add %H:%M to this then select a date in the form it returns the full format in the date field eg. 10-01-2013 09:13 and also in the time field.

How do I separate these formats?
GreyHead 10 Jan, 2013
Hi fruitloopy,

Probably the best way is to use two copies of the Custom MooTools DatePicker action with distinct classes for the two datepickers. That should let you configure them separately.

Bob
Fruitloopy 10 Jan, 2013
Thanks Bob, unfortunately I dont know how to do that.
Sorry.
GreyHead 10 Jan, 2013
Hi fruitloopy,

You'll find the action in the Power Fields group - most of the settings explain themselves.

Bob
This topic is locked and no more replies can be posted.