Customize DatePicker Week Start Day in Bold Reports Report Viewer
To change the first day of the week in a date-time parameter’s calendar in the Bold Reports embedded Report Viewer, set weekStartDay in the viewer’s parameterSettings. In JavaScript, set it directly at initialization. In Blazor, carry the value through your own options class and interop file into parameterSettings.
When to use this
Use this when a report has a date-time parameter and you want its DatePicker calendar to begin on a weekday other than the default. This matches the calendar to a regional or business-week convention without changing the report itself.
Steps
Blazor
-
In the
BoldReportViewerOptions.csfile, add a property to store the week start day value. This property carries the start day through to the DatePicker.public int WeekStartDay { get; set; } -
In the
Index.razorfile, assign the value you want before the viewer renders… Use the mapping in the table below.ViewerOptions.WeekStartDay = 1; // MondayWeekStartDay Day 1 Monday 2 Tuesday 3 Wednesday 4 Thursday 5 Friday 6 Saturday 7 Sunday -
In the
boldreports-interop.jsfile, read the value from your options object and set it onparameterSettings. This is the step that reaches the viewer:parameterSettingsis the object the Report Viewer reads, so the value is inert until you copy it here.// boldreports-interop.js parameterSettings: { weekStartDay: options.weekStartDay } -
Save the changes and run the application.
JavaScript
-
Set the
weekStartDayvalue inparameterSettingswhen you initialize the Report Viewer. ReplacereportServiceUrlandreportPathwith your own values.$("#viewer").boldReportViewer({ reportServiceUrl: "/api/bold-reports/reportviewer", reportPath: "/your-report-path", parameterSettings: { weekStartDay: 1 // 1 = Monday } }); -
Save the changes and run the application.
Result
When you open a date-time parameter, the DatePicker calendar starts on the day you set. The setting applies to every date-time parameter in the report.