setDayOfWeek

Sets the day of a week to a date object.

Parameters

targetDate Date

The date to set the day of the week to.

dayOfWeek Number

The day of the week to be set.

direction Number

The direction that determines the day of the week to be set.

One (1) indicates the day after the current one (default value). Minus one (-1) indicates the day before the current one.

Example

<script>
    var targetDate1 = new Date(2016,10,5,15,25,11);
        targetDate2 = new Date(2016,10,5,15,25,11);
    kendo.date.setDayOfWeek(targetDate1, 1, 1);
    kendo.date.setDayOfWeek(targetDate2, 1, -1);

/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(targetDate1); // Mon Nov 07 2016 15:25:11 GMT+0200 (FLE Standard Time)

/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(targetDate2); // Mon Oct 31 2016 15:25:11 GMT+0200 (FLE Standard Time)
</script>
In this article