So I have an input field where you select a date by clicking on a calendar and then that date is filled into a field.
<input type="text" name="date" value="" class="form-control datepicker" disabled="">
This field is filled when a visitor clicks on the date on a calendar, the date is then passed through to the field above using javascript.
$("td").click(function(){
var day = $(this).find(".day").html();
$(".datepicker").val("<?php echo $this->uri->segment('3'); ?>/"+day+"/<?php echo $this->uri->segment('2'); ?>");
});
To create a value
of something like this for example 07/14/2014
Then I have a drop down with a certain set of times. This is the Weekday Time Schedule:
<select name="time" class="form-control">
<option value="4:30 PM">4:30 PM</option>
<option value="5:30 PM">5:30 PM</option>
<option value="6:30 PM">6:30 PM</option>
<option value="7:30 PM">7:30 PM</option>
</select>
I have a different time frame set for weekends. But I currently have no way to distinguish between what days are weekdays and what days are weekends in the date field.
I am using codeigniter to generate the calendar and the form. So my dropdown looks like this:
<?php echo form_dropdown('time', $week_times, '', 'class="form-control"'); ?>
$week_times need to be converted into an if statement, something like the below so that I can provide two different sets of times based on what day of the week the day falls on for that month.
if(date == weekday){
$times = $week_times;
}
elseif(date == weekend){
$times = $week_end_times;
}
Obviosuly, that isn't a real if statement, but if I had that I wouldn't be asking the question How can I tell if a date field is a weekday or weekend and choose an array based off that information?