Setting the first day of the week on Monday in the kendo scheduler

I want to set the first day of the week on Monday instead of Sunday in the kendo scheduler. It works fine for me if I use DatePicker, but not for the scheduler.

+6
source share
5 answers

Can be done with one line of code. Add

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

before the announcement of the kendo planner

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

Found a solution here and worked for me. Kendo Culture Setting

+3
source

As in Kendo UI v2015.2.805, you need to set the calendar.firstDay property of the current Kendo culture. However, this property is not publicly available, therefore, to prevent compilation of errors in Visual Studio, you will need the following array accessory.

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

Then, as Vishna Vikraman pointed out, create an instance of your planner:

 $("#yourID").kendoScheduler({... }) 
+1
source

The KendoUI Scheduler Widget reads the first day of the week from the current culture .

 <script type="text/javascript"> //set current to the "en-GB" culture script kendo.culture("en-GB"); </script> 
0
source

I see two options depending on what you want:

  • If you find a culture the way you want it, use it. This means that if you use one that is not en-US (the default is one), you will also change the name of the days, decimal separators, currency ...
  • If you need to change the first day of the week for a specific culture. Then you must overwrite the value of kendo.cultures["en-US"].calendars.standard.firstDay (replace en-US with your culture code or use en-US for the default value).

 $("#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> 
0
source

In your kendo.all.min.js script file, find:

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

and change Sunday to the end of the list, for example:

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

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

-2
source

Source: https://habr.com/ru/post/976856/


All Articles