DatePicker start week with monday

3 Answers 810 Views
DatePicker
n/a
Top achievements
Rank 1
Iron
n/a asked on 22 Sep 2022, 09:51 AM | edited on 22 Sep 2022, 09:51 AM

Hello,

 

ist it possibel to set up the DatePicker so that the week starts wit MONDAY and not Sunday?

Thank you, Matjaz Reberc

3 Answers, 1 is accepted

Sort by
0
Kiril
Telerik team
answered on 23 Sep 2022, 06:10 AM

Hi Matjaz,

The week-first-day variable is controlled by the currently loaded `internationalization` context with the default being `en` leading to showing `Sunday` as the first day of the week.

The week-first-day will dynamically update if different context is loaded. For example, if `en-GB` localization is loaded, the first day of the week would be `Monday`. Please check out the following example demonstrating how to load Internationalization context:

https://stackblitz.com/edit/react-ugbidg?file=app/main.tsx

Please let me know if this helps!

Regards,
Kiril
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

n/a
Top achievements
Rank 1
Iron
commented on 04 Oct 2022, 09:38 AM

Hi Kril,

 

yes, it works.

 

Thank you, Matjaz

0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 28 Oct 2024, 12:32 PM
It would be great a property:
weekStartDay={1}
Konstantin Dikov
Telerik team
commented on 29 Oct 2024, 09:12 AM

Hi Jefferson,

I can agree that it will be convenient in some scenarios to have such property, but that will defeat the use of the cdrl locale data within the component. As a workaround, you can override the firstDate of the loaded weekData as shown in the following example:

0
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 29 Oct 2024, 01:11 PM

Solution for Telerik UI for React, in pt-BR:

load(
    likelySubtags,
    weekData,
    ptNumbers,
    ptCaGregorian,
    ptDateFields,
    ptTimeZoneNames
);
if (!weekData.supplemental) {
  weekData.supplemental = {};
}
if (!weekData.supplemental.weekData) {
  weekData.supplemental.weekData = {};
}
if (!weekData.supplemental.weekData.firstDay) {
  weekData.supplemental.weekData.firstDay = {};
}

 

weekData.supplemental.weekData.firstDay.BR = 'mon'; // Brazil

// Other

weekData.supplemental.weekData.firstDay.PT = 'mon';

weekData.supplemental.weekData.firstDay.US = 'mon';

Tags
DatePicker
Asked by
n/a
Top achievements
Rank 1
Iron
Answers by
Kiril
Telerik team
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or