24Hours for events in monthview fullcalendar - asp.net

In week and day view im getting the time in 24H for the events, but on monthview it showed as AM/PM, so a event in week/day view is showed 22:00 and on/in monthview it showed 10p "Eventname", how do i changes that !?
I have this in my script.
22:00 is showed as 10p
timeFormat: { agenda: 'H:mm{ - HH:mm}' }, dragOpacity: { agenda: 0.5 }, minTime: 0,
and if i use this
timeFormat: { '': 'HH:mm' }, isRTL: false,
Then its right on monthview with 22:00 but then its showing the time in week/day view as 10:00.

You want 24h in all cases? Try: timeFormat: 'HH:mm{-HH:mm}'

Related

Fullcalendar - Showing partial dates (for a night shift)

I'm trying to show a calendar for a person that works a night shift. I intend to show a calendar type 'resourceTimeline' from the current day at 6 pm to the next day at 3 am.
I've tried
visibleRange: {
start: '2021-04-13 18:00:00',
end: '2020-04-14 03:59:59'
}
but it only shows the current date until midnight.
I tried using slotMinTime and slotMaxTime but if the slotMinTime is greater then slotMaxTime it crashes.
Here is my view definition:
nightShift: {
type: 'resourceTimeline',
slotDuration: { hours: 1 },
visibleRange: {
start: '2021-04-13T18:00:00',
end: '2020-04-15 03:59:59'
},
buttonText: 'Night Shift',
slotLabelFormat: [
{
day: 'numeric',
weekday: 'short'
},
{
hour: 'numeric',
minute: 'numeric',
hourCycle: 'h23'
}
]
}
Is there any way to achieve what I want?
You can set slotMaxTime to "28:00:00"

How can I add non-businessHours on fullCalendar

In my calendar, I would like to not see the events but instead have the range of the event greyed like what is not in the businessHours range.
For example, if I have those businessHours:
businessHours: {
start: '08:00',
end: '12:00'
}
and an event which starts at 10:00 and finishes at 11:00, I would like to have the exact same render as :
businessHours: [
{
start: '08:00',
end: '10:00'
},
{
start: '11:00',
end: '12:00'
}
]
Is there a way to add unavailable range of time like this ?
Thanks.

fullcalendar scheduler columnFormat & slotLabelFormat

I am using fullcalendar scheduler and trying to set timeformat on the timeline to be in 24:00 format not in 12am or pm format.
The default timeline view has 12am/pm format and the threeday timeline has an extra row on top for the day http://fullcalendar.io/scheduler/ .
I think that the columnformat could be the key here. but unfortunately when i use slotLabelFormat:'H:mm' to get the timeline show 24:00 format, the columns displaying the date disappear on the 3 day view.
Is this a bug or am i doing something wrong?
This is how it works correctly:
views: {
timelineThreeDays: {
type: 'timeline',
slotLabelFormat: [
'ddd D/M',
'H:mm'
],
columnFormat: 'ddd D.M',
duration: { days: 3 }
}
},

fullcalendar adding event entry after 10 pm shows in same day and also replicates in next day

if i try to add the event entry for after 10pm, its replicates in another day also.
ex: Adding entry for 2015-08-10T22:15:00(Monday), it replicates in another day(Tuesday) at 12am also.
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaWeek'
},
defaultView: 'agendaWeek',
defaultDate: '2015-08-10',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'All Day Event',
start: '2015-08-10T21:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2015-08-10T23:15:00'
}
]
});
});
I cant edit it. But the reason is that the event is showing the correct duration and hence stretching beyond 12 am on Tuesday. For example if the event is for 2 hours duration and you set the start time as 22:15 pm on Monday, the end time would be 00:15 on Tuesday (which is 12:15 am on Tuesday). I can't edit a thing but can drag and reschedule it for Monday.
I have moved it to start at 10:45 and end at 11:45 and its not duplicating over to Tuesday

How to add multiple business hours in fullCalendar?

Is there any way to set multiple business hours, or grey out certain time ranges in FullCalendar's agenda view? I'm searching the google for hours, but I didn't find any working answer.
Here's what I've tried:
businessHours:
[
{
start: '08:00',
end: '17:00',
dow: [ 1,2,3,4,5 ]
},
{
start: '10:00',
end: '16:00',
dow: [ 6 ]
}]
This is not working. The fullcalendar recognizes this array as a true value, and sets the default value of businesHours.
This works:
businessHours:
{
start: '08:00',
end: '17:00',
dow: [ 1,2,3,4,5 ]
}
But I want to be able to customize every day's opening hours. Is there any way to solve this? If I could add somehow a css class to certain time ranges that would do it, but I don't know how to grab these time ranges. Render doesn't work, because of agenda view.
I figured out a solution. It is not the best way, to solve this problem, but it is easy to understand and implement, until we don't get a more customizable businessHours() function in an upcoming update.
The code:
events: [
{
start: '00:00:00+02:00',
end: '08:00:00+02:00',
color: 'gray',
rendering: 'background',
dow: [1,2,3,4,5]
},
{
start: '16:00:00+02:00',
end: '24:00:00+02:00',
color: 'gray',
rendering: 'background',
dow: [1,2,3,4,5]
},
{
start: '00:00:00+02:00',
end: '8:00:00+02:00',
color: 'gray',
rendering: 'background',
dow: [6]
},
{
start: '12:00:00+02:00',
end: '24:00:00+02:00',
color: 'gray',
rendering: 'background',
dow: [6]
}
]
This will put background events in the Calendar, which are not clickable, and looks like businessHours()'s gray out, and will change the background color of every slot in agendaWeek and agendaDay from 00:00 to 08:00, 16:00 to 24:00 (from Mondays to Fridays - dow:[1,2,3,4,5]), and from 00:00 to 08:00, 12:00 to 24:00 (On Saturdays - dow:[6]).
You can add each business hour as an event. FullCalendar works with the same structure to populate businessHours option:
{
...
events: [
// business hours 1
{
className: 'fc-nonbusiness',
start: '09:00',
end: '17:00',
dow: [1, 2, 3, 4], // monday - thursday
rendering: 'inverse-background'
},
// business hours 2
{
className: 'fc-nonbusiness',
start: '10:00',
end: '15:00',
dow: [6], // saturday
rendering: 'inverse-background'
}],
...
}
Note: The important options in this events are className:'fc-nonbusiness and rendering:'inverse-background'.
Good Luck.

Resources