- Home
- Forum
- ASP.NET MVC - EJ 2
- StartHour / EndHour being ignored
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()
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.
[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
Wonderful, thank you! Not sure how I missed that.
Georg,
You are welcome. Let us know if you need any further assistance.
- 3 Replies
- 3 Participants
- Marked answer
-
GT Georg Thomas
- Jun 18, 2023 04:02 AM UTC
- Jun 20, 2023 03:47 PM UTC