Skip to content

Commit

Permalink
Merge pull request #570 from nhn/fix/issue-553
Browse files Browse the repository at this point in the history
Fix incorrect date label on monthly view on example file(fix #553)
  • Loading branch information
jungeun-cho authored Apr 17, 2020
2 parents fc9e85f + 5ffba77 commit 1521b32
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions examples/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

/* eslint-disable require-jsdoc */
/* eslint-disable */
/* eslint-env jquery */
/* global moment, tui, chance */
/* global findCalendar, CalendarList, ScheduleList, generateSchedule */
Expand Down Expand Up @@ -372,16 +372,23 @@
calendarTypeIcon.className = iconClassName;
}

function currentCalendarDate(format) {
var currentDate = moment([cal.getDate().getFullYear(), cal.getDate().getMonth(), cal.getDate().getDate()]);

return currentDate.format(format);
}

function setRenderRangeText() {
var renderRange = document.getElementById('renderRange');
var options = cal.getOptions();
var viewName = cal.getViewName();

var html = [];
if (viewName === 'day') {
html.push(moment(cal.getDate().getTime()).format('YYYY.MM.DD'));
html.push(currentCalendarDate('YYYY.MM.DD'));
} else if (viewName === 'month' &&
(!options.month.visibleWeeksCount || options.month.visibleWeeksCount > 4)) {
html.push(moment(cal.getDate().getTime()).format('YYYY.MM'));
html.push(currentCalendarDate('YYYY.MM'));
} else {
html.push(moment(cal.getDateRangeStart().getTime()).format('YYYY.MM.DD'));
html.push(' ~ ');
Expand All @@ -394,11 +401,7 @@
cal.clear();
generateSchedule(cal.getViewName(), cal.getDateRangeStart(), cal.getDateRangeEnd());
cal.createSchedules(ScheduleList);
// var schedules = [
// {id: 489273, title: 'Workout for 2019-04-05', isAllDay: false, start: '2018-02-01T11:30:00+09:00', end: '2018-02-01T12:00:00+09:00', goingDuration: 30, comingDuration: 30, color: '#ffffff', isVisible: true, bgColor: '#69BB2D', dragBgColor: '#69BB2D', borderColor: '#69BB2D', calendarId: 'logged-workout', category: 'time', dueDateClass: '', customStyle: 'cursor: default;', isPending: false, isFocused: false, isReadOnly: true, isPrivate: false, location: '', attendees: '', recurrenceRule: '', state: ''},
// // {id: 18073, title: 'completed with blocks', isAllDay: false, start: '2018-11-17T09:00:00+09:00', end: '2018-11-17T10:00:00+09:00', color: '#ffffff', isVisible: true, bgColor: '#54B8CC', dragBgColor: '#54B8CC', borderColor: '#54B8CC', calendarId: 'workout', category: 'time', dueDateClass: '', customStyle: '', isPending: false, isFocused: false, isReadOnly: false, isPrivate: false, location: '', attendees: '', recurrenceRule: '', state: ''}
// ];
// cal.createSchedules(schedules);

refreshScheduleVisibility();
}

Expand Down

0 comments on commit 1521b32

Please sign in to comment.