Setting first day of week to Monday in kendo sched

2019-06-19 08:21发布

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条回答
混吃等死
2楼-- · 2019-06-19 09:07

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>
查看更多
闹够了就滚
3楼-- · 2019-06-19 09:15

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({... })
查看更多
ら.Afraid
4楼-- · 2019-06-19 09:19

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

查看更多
smile是对你的礼貌
5楼-- · 2019-06-19 09:19

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

查看更多
forever°为你锁心
6楼-- · 2019-06-19 09:20

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>

查看更多
登录 后发表回答