6

I want to set first day of week to monday instead of sunday in kendo scheduler It is working fine for me if i am using DatePicker, but not for Scheduler.

5 Answers5

3

Can be made possible with one line of code. Add

kendo.culture().calendar.firstDay = 1;

before kendo scheduler declaration

$("#yourID").kendoScheduler({... })

Found the solution here and worked for me. Kendo culture setting

Community
  • 1
  • 1
1

As of Kendo UI v2015.2.805, you need to set the calendar.firstDay property of the current Kendo culture. However, this property is not public, so you'll need to use the following array accessor in order to avoid compile errors in Visual Studio.

kendo.culture().calendar["firstDay"] = 1;

Then, as Vishn Vikraman pointed out, instantiate your scheduler:

$("#yourID").kendoScheduler({... })
MFry
  • 81
  • 1
  • 3
0

KendoUI Scheduler widget the first day of the week is read from the current culture.

<script type="text/javascript">
     //set current to the "en-GB" culture script
     kendo.culture("en-GB");
</script>
Jarno Lahtinen
  • 1,713
  • 17
  • 30
  • Keep in mind that this works if you pick a culture where the first day of the week is actually set to be Monday. Unfortunately, many cultures don't start with Monday (es-ES, for example) – chiapa Oct 17 '14 at 09:33
0

I see two options depending on what you want:

  1. If you find a culture that is how you want it then use it. This means that if you are using one that is not en-US (default one), you will be changing also name of days, decimals separators, currency...
  2. If you just need to change the first day of the week for a specific culture. Then you should overwrite the value kendo.cultures["en-US"].calendars.standard.firstDay (replace en-US by you culture code or use en-US for the default).

$("#date1").kendoDatePicker({
    culture: "es-ES"
});


// Force first day of week to 1 = Monday for en-US
kendo.cultures["en-US"].calendars.standard.firstDay = 1; 
$("#date2").kendoDatePicker({
});
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.default.min.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2014.2.716/js/kendo.all.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/cultures/kendo.culture.es-ES.min.js"></script>

<div>es-ES: <input id="date1"/></div>
<div>en-US (modified): <input id="date2"/></div>
OnaBai
  • 40,767
  • 6
  • 96
  • 125
  • It seems to me that your answer is for the control [DatePicker](http://docs.telerik.com/kendo-ui/web/datepicker/overview) but the question is about the [Kendo UI Scheduler widget](http://docs.telerik.com/kendo-ui/web/scheduler/overview). Am i mistaken? – surfmuggle Dec 05 '14 at 13:09
-2

In your kendo.all.min.js script file, look for:

calendars:{standard:{days:{names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]

and change Sunday to the end of the list, like this:

calendars:{standard:{days:{names:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday", "Sunday"]

Do the same for the short names, right after the "calendars" part in the script

chiapa
  • 4,362
  • 11
  • 66
  • 106
  • Maybe change Kendo UI locale to get this done. Changing Kendo UI source isn't the right way to do this. – Jarno Lahtinen Oct 17 '14 at 09:20
  • @Japi, in many of the cultures, the first day of the week will still be Sunday (es-ES, for example), so setting the culture won't fix it. This is a workaround that works for any culture. Furthermore, setting culture may cause the change of in-widget texts that have to be set later as custom by the developer. In addition, you change this once, no need to set the culture for every scheduler on the application. PS: there's no reason for a downvote. – chiapa Oct 17 '14 at 09:31
  • I'd still change culture and fix first day in culture file. That's the reason why they exist. Questions is, are the locale files correct? – Jarno Lahtinen Oct 17 '14 at 09:48