StartHour / EndHour being ignored

Hello, I've specified work hours and set start/end hours in the scheduler, but it ignores it and defaults to midnight.


Not sure what I am doing wrong?


    @Html.EJS().Schedule("schedule").Width("100%").Height("650px").CssClass("room-schedule").SelectedDate(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day)).CurrentView(View.TimelineWeek).WorkHours(new ScheduleWorkHours { Start = "07:00", End = "18:00" }).StartHour("7").EndHour("18").ShowWeekend(true).TimeScale(ts => ts.SlotCount(1).Interval(60)).Views(view => { view.Option(View.TimelineDay).Add(); view.Option(View.TimelineWeek).Add(); }).ResourceHeaderTemplate("#resource-template").Group(group => group.EnableCompactView(false).Resources(ViewBag.ResourceNames)).Resources(res => { res.DataSource(ViewBag.RoomDatas).Field("RoomId").Title("Room Type").Name("MeetingRoom").TextField("name").IdField("id").ColorField("color").AllowMultiple(true).Add(); }).EventSettings(e => e.Fields(f => f.Subject(sub => sub.Name("Subject").Title("Summary")).Location(loc => loc.Name("Location").Title("Location")).Description(des => des.Name("Description").Title("Comments")).StartTime(st => st.Name("StartTime").Title("From")).EndTime(et => et.Name("EndTime").Title("To"))).DataSource(ViewBag.datasource)).PopupOpen("onPopupOpen").RenderCell("onRenderCell").EventRendered("onEventRendered").ActionBegin("onActionBegin").Render()


3 Replies 1 reply marked as answer

SR Swathi Ravi Syncfusion Team June 19, 2023 09:37 AM UTC

Hi Georg,


We have checked the problem you reported using the code snippets you provided, and we discovered that the StartHour and EndHour value formats you provided are incorrect. By entering the proper format (07:00), as demonstrated in the shared sample below, you can resolve this problem.


Api: https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.schedule.schedule.html#Syncfusion_EJ2_Schedule_Schedule_StartHour

                https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.schedule.schedule.html#Syncfusion_EJ2_Schedule_Schedule_EndHour

UG: https://ej2.syncfusion.com/aspnetmvc/documentation/schedule/working-days?cs-save-lang=1&cs-lang=razor#scheduler-displaying-custom-hours


[index.cshtml]

@(Html.EJS().Schedule("schedule")

    .Views(view => {

        view.Option(View.TimelineDay).Add();

        view.Option(View.TimelineWeek).Add();

    })

    .EventSettings(new ScheduleEventSettings { DataSource = ViewBag.datasource })

     .WorkHours(new ScheduleWorkHours { Start = "07:00", End = "18:00" }

    )

    .StartHour("07:00")

    .EndHour("18:00")

    .SelectedDate(new DateTime(2023, 2, 15))

    .Render()

)



Output:





Regards,

Swathi Ravi


Attachment: mvcschedule_77def41.zip

Marked as answer

GT Georg Thomas June 19, 2023 10:12 AM UTC

Wonderful, thank you! Not sure how I missed that.



RV Ravikumar Venkatesan Syncfusion Team June 20, 2023 03:47 PM UTC

Georg,


You are welcome. Let us know if you need any further assistance.


Loader.
Up arrow icon