Fixed bug with unseen events
The bug occured because the currentMonth + 1 went over the limit
This commit is contained in:
@@ -224,6 +224,38 @@ export const useCalendar = defineStore('calendar', () => {
|
||||
params.month = newValue.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the previous month number
|
||||
*
|
||||
* @param monthNumber Initial month
|
||||
* @returns The previous month number in the year
|
||||
*/
|
||||
function getPreviousMonth(monthNumber: number): number {
|
||||
const target: number = monthNumber - 1
|
||||
|
||||
if (target < 0) {
|
||||
return monthsPerYear - 1
|
||||
}
|
||||
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the following month number
|
||||
*
|
||||
* @param monthNumber Initial month
|
||||
* @returns The next month number in the year
|
||||
*/
|
||||
function getNextMonth(monthNumber: number): number {
|
||||
const target: number = monthNumber + 1
|
||||
|
||||
if (target + 1 >= monthsPerYear) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the current date to a particular month
|
||||
*/
|
||||
@@ -370,6 +402,8 @@ export const useCalendar = defineStore('calendar', () => {
|
||||
incrementMonth,
|
||||
decrementMonth,
|
||||
setMonth,
|
||||
getPreviousMonth,
|
||||
getNextMonth,
|
||||
incrementYear,
|
||||
decrementYear,
|
||||
jumpToDate,
|
||||
|
||||
Reference in New Issue
Block a user