Issue with slotLabelInterval and odd time settings - fullcalendar

I am trying to change the slotLabelInterval to show a narrow range of time for the days, but it seems to have an issue with using odd intervals. If you use odd intervals 3:30, 4:30, 5:00, 7:00 the first day will be correct, but subsequent days will be off from what they should be for the day. So, if I start with day one at 8:30 with a 3:30 interval, I will get a 12pm and a 3:30pm on the first day. But the second day will start at 9:00am then 12:30pm and 4:00pm and the next day will be 9:30am start, 1:00pm and 4:30pm. But if you give it an even number every thing works fine.
I believe this is a bug in the calculations because it you do the math on the times, each days time is a mulitple of the 3:30 interval. For instance, the last time on day one is 3:30pm + 3:30 + 3:30 + 3:30 + 3:30 + 3:30 = 9am on the next day.
What I am looking for is to confirm this is an issue and possible understand what the solutions for this could be.
[Edit] I am attaching a code snippit and screenshot of the issue. SCREENSHOT
<script>
$(function() {
$('#calendar').fullCalendar({
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
now: '{!calCurrentDate}',
minTime: '08:30',
maxTime: '17:00',
slotLabelInterval: '03:30:00',
slotDuration: '03:30:00',
snapDuration: '03:30:00',
slotLabelFormat: ['dddd MMM DD, YYYY','h(:mm)a'],
slotWidth: '75',
editable: true, // enable draggable events
businessHours: false,
aspectRatio: 2.75,
scrollTime: '08:00', // undo default 6am scrollTime

Related

Disable past days in Fullcalendar

I'm using fullcalendar with agendaWeek as defaultView. How can i make past days as non selectable .
For ex today is 15th August and i don't want to let user to select dates older , like on 13th August.
Thank you
It seems that the best solution is to use the option validRange
validRange: {
start: today,
end: '2025-06-01'
},
where
var today = new Date();
end the end date is some date in distant future.

FullCalendar how to display day name above day view

I am using the FullCalendar scheduler and wish to have my calendar set to Agenda Day view, with the option of selecting Week or Month. However, my concern is that the actual day of the week does not show in the default view, only the date as follows:
January 15th, 2018
I really want to have something like:
Monday, January 15th
I don't really even need the year.
The days do appear in week and month view no problem, but I cannot find a setting that allows the day to appear for the day view, which will be extremely useful when users are wanting to skip to 'next Friday' for example without having to consult another view to find out the actual date.
Any ideas?
This is controlled by the "titleFormat" option. You can combine this with view-specific options to change the title only for "day" views:
views: {
day: {
titleFormat: 'dddd, MMMM Do YYYY'
}
},
See http://jsfiddle.net/sbxpv25p/105/ for a working demo.
See also
1) https://fullcalendar.io/docs/text/titleFormat/ (title format option)
2) https://fullcalendar.io/docs/views/View-Specific-Options/ (view specific options)
3) https://fullcalendar.io/docs/utilities/date_formatting_string/ and http://momentjs.com/docs/#/displaying/format/ (characters which can be used to format the date)
With Fullcalendar v5 the syntax changed a little. The format is defined by the local. Weekdays are added by an additional attribute and date formatting:
locale: 'en',
views: {
day: {
titleFormat: {
year: 'numeric', month: 'long', day: 'numeric', weekday: 'short'
},
},
},
See
https://fullcalendar.io/docs/v5/locale
https://fullcalendar.io/docs/v5/titleFormat
https://fullcalendar.io/docs/v5/date-formatting

FullCalendar SlotDuration 24:00 and weekNumbers: true alters date formatting

I am using full calendar scheduler.. and the setting
dayOfMonthFormat: 'ddd - MMM DD',
to give columns like Mon - Nov 28
I also have weekNumbers: true set
this works great for views with slots, i.e. a minTime, maxTime, a slotDuration i.e. 3 hours.
I get a display like this
--
However, if I have a view where the slotDuration is 24 hours, I can have the weekNumbers but the Date Formatting is ignored / wrong.
i.e.
--
I can force the date to the correct format by putting slotLabelFormat: 'ddd - MMM DD', in my view.. but this means I get no weekNumbers
--
Does anyone know of a solution where both my custom date / column format will work, but that I will also get my weekNumbers, with 24 hour slots?
FullCalendar support suggest this, which worked out in my case.
slotLabelFormat: [
'[Week] W',
'ddd - MMM DD'
]
Update: 11/03/2022
for FullCalendar v5 I am using:
slotLabelFormat: [
function(date) { return moment(date.date).format('[Week] W') },
function(date) { return moment(date.date).format('ddd - MMM DD') }
],

Make night mode on fullcalendar

I need a option for night mode in a fullcalendar(adamshaw) agenda week view, that is it show the night time only for example 8pm to 8am (from top 8pm to continue until 8am) is there any help regarding this?
Check out the businessHours on the fullcalendar docs. You can specify start and end times and optionally days of the week.
{
start: '10:00', // a start time (10am in this example)
end: '18:00', // an end time (6pm in this example)
dow: [ 1, 2, 3, 4 ]
// days of week. an array of zero-based day of week integers (0=Sunday)
// (Monday-Thursday in this example)
}
Very easy:
minTime: "20:00",
maxTime: "32:00",
Use this in fullCalendar options when creating it.

Full Calendar: How to create an event with a duration of more than 24 hours?

I am using FullCalendar and when I set the calendar view to Week View and try to create an event with a duration greater than 1 day, the event's start time label is changed to 0:00 and won't update. I have tried to increase the maxTime to more than 24 hours as follows (Which did not help):
fcViews.agenda = {
'class': AgendaView,
defaults: {
allDaySlot: true,
allDayText: 'all-day',
slotDuration: '00:30:00',
minTime: '00:00:00',
maxTime: '48:00:00',
slotEventOverlap: true // a bad name. confused with overlap/constraint system
}
};
I tried to do the same on the calendar at FullCalendar's official webpage and it has the same behavior. Could anyone help please?
Namaste #Arvindji
Calendar timeline should not be greater than 1 day. You should restrict max time to 24:00:00
maxTime: '24:00:00',
Because if you set maxTime: '48:00:00', then fullcalendar will show 48 hours in one day as a result each day column in fullcalendar will have 48 hours. Here there is a loophole in timeline. But the event will not show properly.
So try to bind 24 hours as max time and see result, calendar will break events sharing two days into two parts for both days separately.

Resources