vendredi 28 avril 2017

Date range in "if" statement

I have this piece of code:

function auto_select_param_call_time() {
    if (today() == date("02.01.2017") || today() == date("03.01.2017")) {
        auto_click_param("call_time", "Non-working day");
    } else {
        //Do something else
    }
}

As you can see, it checks if it's any holidays today. Now there are around 8 new holidays I need to add to this 'If'. If just write them all down like "today() == date("02.01.2017")" it will turn really ugly and big really fast.

Is there any way I can write a range of dates? For example, "if it between 06.05.2017 and 9.05.2017, then...", WITHOUT using a switch?

Or any other way?

Aucun commentaire:

Enregistrer un commentaire