nehakadam / AnyPicker

jQuery Picker Library for Android, iOS & Windows Phone. eg Date Picker, Time Picker, DateTime Picker, Custom Select etc
https://nehakadam.github.io/AnyPicker/
MIT License
116 stars 37 forks source link

Desactivate a full day (except weekends) #9

Closed aymendhaya closed 8 years ago

aymendhaya commented 8 years ago

Hello developers, here is my proposition:

disableValues: 
{
    datetime: [
        {
            val: "May 06,2015 02:30 AM"
        }
    ],

    day: [0, 6]                     
}

Why not having ability to put simply val: "May 06,2015" if we want to set a full day as Invalid ?

Have a good reception.

nehakadam commented 8 years ago

To keep it simple, Dates/Times/DateTimes in the dateTimeFormat are allowed to be specified as disableValues.

To set entire day as disabled value, you can use -

datetime: [
    {
        start: "01-03-2015 00:00",
        end: "01-03-2015 23:59"    
    }
]
aymendhaya commented 8 years ago

Hello again, Sorry for not getting it well, this is some details. If we consider that i have:

mode: "datetime", dateTimeFormat: "dd/MM/yyyy", inputDateTimeFormat: "dd/MM/yyyy", minValue: new Date(2016, 00, 01), maxValue: new Date(2016, 00, 15),

and i want to desactivate for example the entire 03/01/2016, what should i put in disableValues section ? PS: i don't need time picker for this case. Thank you in advance :)

nehakadam commented 8 years ago

You can achieve it with following code -

$(document).ready(function()
{
    $("#ip-de").AnyPicker(
    {

        mode: "datetime",

        dateTimeFormat: "dd/MM/yyyy",

        inputDateTimeFormat: "dd/MM/yyyy",

        selectedDate: "05/01/2016", 

        minValue: new Date(2016, 0, 01),

        maxValue: new Date(2016, 0, 15),

        disableValues: {

            date: [
                {
                    val: "03/01/2016"
                }
            ]
        }
    });
});