Skip to content
Snippets Groups Projects
Verified Commit 911a01cb authored by Miniontoby's avatar Miniontoby :writing_hand_tone1:
Browse files

Fixed the month skipped issue by setting the date to 1 when the date is 31

parent 37a7ff8a
No related branches found
No related tags found
No related merge requests found
Pipeline #144442 passed
...@@ -97,7 +97,12 @@ function openModal(date, eventForDay = null) { ...@@ -97,7 +97,12 @@ function openModal(date, eventForDay = null) {
function load() { function load() {
const dt = new Date(); const dt = new Date();
if (nav !== 0) dt.setMonth(new Date().getMonth() + nav); if (nav !== 0) {
// If today is 31th, we need to set the date to 1, cause else we will 'skip' months
// since if the next month is to 30, then 31 - 30 = next month 1st.
if (dt.getDate() == 31) dt.setDate(1);
dt.setMonth(dt.getMonth() + nav);
}
const day = dt.getDate(); const day = dt.getDate();
const month = dt.getMonth(); const month = dt.getMonth();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment