From 3a405608e498d1b8ed62301174a586043044b824 Mon Sep 17 00:00:00 2001 From: KB Bot Date: Mon, 30 Sep 2024 11:20:09 +0000 Subject: [PATCH 1/5] Added new kb article datepicker-kb-change-starting-day-of-week --- ...tepicker-kb-change-starting-day-of-week.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 knowledge-base/datepicker-kb-change-starting-day-of-week.md diff --git a/knowledge-base/datepicker-kb-change-starting-day-of-week.md b/knowledge-base/datepicker-kb-change-starting-day-of-week.md new file mode 100644 index 0000000000..43db8a16b8 --- /dev/null +++ b/knowledge-base/datepicker-kb-change-starting-day-of-week.md @@ -0,0 +1,60 @@ +--- +title: How to Change the Default Starting Day of the Week +description: Learn how to set the first day of the week to different from the default one in the Telerik Blazor DatePicker component by modifying the current culture settings. +type: how-to +page_title: How to Change the Default Starting Day of the Week +slug: datepicker-kb-change-starting-day-of-week +tags: datepicker, blazor, cultureinfo, firstdayofweek +res_type: kb +ticketid: 1665695 +--- + +## Environment + + + + + + + +
ProductDatePicker for Blazor, Calendar for Blazor
+ +## Description + +This KB article answers the following questions: +* How can I change the first day of the week in the DatePicker? +* Is it possible to set different day as the start of the week from the default one in the Telerik DatePicker for Blazor? +* What steps should I follow to modify the start of the week in a DatePicker component? + +## Solution + +To set the start of the week to dfferent one in the Telerik DatePicker for Blazor, override the `FirstDayOfWeek` property of the current culture in your application. Follow the steps below to implement this solution: + +1. Include the necessary namespaces for [globalization]({%slug globalization-formats%]) in your component. +2. Add the Telerik DatePicker to your component. +3. Override the `OnInitialized` method to change the current culture's `FirstDayOfWeek` to the desired one. + +````CSHTML + +@using System.Globalization + + + +@code { + private DateTime Date { get; set; } = DateTime.Now; + + protected override void OnInitialized() + { + var cultureInfo = new CultureInfo("en-US"); + cultureInfo.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Monday; + CultureInfo.DefaultThreadCurrentCulture = cultureInfo; + CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; + } +} +```` + +By setting the `FirstDayOfWeek` property to `DayOfWeek.Monday`, the DatePicker will start the week with Monday based on the modified culture settings. + +## See Also + +- [DatePicker Overview Documentation]({%slug components/datepicker/overview%}) From ce54e9d9b632544d8f8bc1b87d78cbe688b51d02 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:17:34 +0300 Subject: [PATCH 2/5] docs(DatePicker): kb polish --- knowledge-base/datepicker-kb-change-starting-day-of-week.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knowledge-base/datepicker-kb-change-starting-day-of-week.md b/knowledge-base/datepicker-kb-change-starting-day-of-week.md index 43db8a16b8..4239cd2149 100644 --- a/knowledge-base/datepicker-kb-change-starting-day-of-week.md +++ b/knowledge-base/datepicker-kb-change-starting-day-of-week.md @@ -30,8 +30,8 @@ This KB article answers the following questions: To set the start of the week to dfferent one in the Telerik DatePicker for Blazor, override the `FirstDayOfWeek` property of the current culture in your application. Follow the steps below to implement this solution: -1. Include the necessary namespaces for [globalization]({%slug globalization-formats%]) in your component. -2. Add the Telerik DatePicker to your component. +1. Include the necessary namespaces for [globalization]({%slug globalization-formats%}) in your component. +2. Add the Telerik DatePicker component to your razor page. 3. Override the `OnInitialized` method to change the current culture's `FirstDayOfWeek` to the desired one. ````CSHTML From d979ad0482a060ce42725ac54e07c0ffee2e0dd3 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:23:53 +0300 Subject: [PATCH 3/5] Update knowledge-base/datepicker-kb-change-starting-day-of-week.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- knowledge-base/datepicker-kb-change-starting-day-of-week.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/datepicker-kb-change-starting-day-of-week.md b/knowledge-base/datepicker-kb-change-starting-day-of-week.md index 4239cd2149..242d186872 100644 --- a/knowledge-base/datepicker-kb-change-starting-day-of-week.md +++ b/knowledge-base/datepicker-kb-change-starting-day-of-week.md @@ -1,6 +1,6 @@ --- title: How to Change the Default Starting Day of the Week -description: Learn how to set the first day of the week to different from the default one in the Telerik Blazor DatePicker component by modifying the current culture settings. +description: Learn how to set a first day of the week that's different from the default one in the Telerik Blazor DatePicker component by modifying the current culture settings. type: how-to page_title: How to Change the Default Starting Day of the Week slug: datepicker-kb-change-starting-day-of-week From b8a6d0517d2debcd75c699a2aca2a7ed680234c0 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:24:02 +0300 Subject: [PATCH 4/5] Update knowledge-base/datepicker-kb-change-starting-day-of-week.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- knowledge-base/datepicker-kb-change-starting-day-of-week.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/datepicker-kb-change-starting-day-of-week.md b/knowledge-base/datepicker-kb-change-starting-day-of-week.md index 242d186872..cac9cbfac1 100644 --- a/knowledge-base/datepicker-kb-change-starting-day-of-week.md +++ b/knowledge-base/datepicker-kb-change-starting-day-of-week.md @@ -23,7 +23,7 @@ ticketid: 1665695 This KB article answers the following questions: * How can I change the first day of the week in the DatePicker? -* Is it possible to set different day as the start of the week from the default one in the Telerik DatePicker for Blazor? +* Is it possible to set a different day as the start of the week from the default one in the Telerik DatePicker for Blazor? * What steps should I follow to modify the start of the week in a DatePicker component? ## Solution From 34f5a96fd7d570493031f4532501bbf3db5d3159 Mon Sep 17 00:00:00 2001 From: Tsvetomir Hristov <106250052+Tsvetomir-Hr@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:24:08 +0300 Subject: [PATCH 5/5] Update knowledge-base/datepicker-kb-change-starting-day-of-week.md Co-authored-by: Iva Stefanova Koevska-Atanasova --- knowledge-base/datepicker-kb-change-starting-day-of-week.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge-base/datepicker-kb-change-starting-day-of-week.md b/knowledge-base/datepicker-kb-change-starting-day-of-week.md index cac9cbfac1..174294a483 100644 --- a/knowledge-base/datepicker-kb-change-starting-day-of-week.md +++ b/knowledge-base/datepicker-kb-change-starting-day-of-week.md @@ -28,7 +28,7 @@ This KB article answers the following questions: ## Solution -To set the start of the week to dfferent one in the Telerik DatePicker for Blazor, override the `FirstDayOfWeek` property of the current culture in your application. Follow the steps below to implement this solution: +To set the start of the week to a different one in the Telerik DatePicker for Blazor, override the `FirstDayOfWeek` property of the current culture in your application. Follow the steps below to implement this solution: 1. Include the necessary namespaces for [globalization]({%slug globalization-formats%}) in your component. 2. Add the Telerik DatePicker component to your razor page.