Articles in this section

Customize DatePicker Week Start Day in Bold Reports Report Viewer

Published:
Updated:

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.

image.png

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

  1. In the BoldReportViewerOptions.cs file, 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; }
    

    image.png

  2. In the Index.razor file, assign the value you want before the viewer renders… Use the mapping in the table below.

    ViewerOptions.WeekStartDay = 1; // Monday
    

    image.png

    WeekStartDay Day
    1 Monday
    2 Tuesday
    3 Wednesday
    4 Thursday
    5 Friday
    6 Saturday
    7 Sunday
  3. In the boldreports-interop.js file, read the value from your options object and set it on parameterSettings. This is the step that reaches the viewer: parameterSettings is the object the Report Viewer reads, so the value is inert until you copy it here.

    // boldreports-interop.js
    parameterSettings: {
        weekStartDay: options.weekStartDay
    }
    

    image.png

  4. Save the changes and run the application.

    image.png

JavaScript

  1. Set the weekStartDay value in parameterSettings when you initialize the Report Viewer. Replace reportServiceUrl and reportPath with your own values.

    $("#viewer").boldReportViewer({
        reportServiceUrl: "/api/bold-reports/reportviewer",
        reportPath: "/your-report-path",
        parameterSettings: {
            weekStartDay: 1 // 1 = Monday
        }
    });
    
  2. Save the changes and run the application.

    image.png

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.

Related articles

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied