Skip to content

Commit

Permalink
fix: when move to prev calendar in monthly view resolve incorrect dis…
Browse files Browse the repository at this point in the history
…played range text date label on examples
  • Loading branch information
jungeun-cho committed Apr 14, 2020
1 parent 2d06b1e commit c233b6c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 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 All @@ -12,7 +12,7 @@
var datePicker, selectedCalendar;

cal = new Calendar('#calendar', {
defaultView: 'week',
defaultView: 'month',
useCreationPopup: useCreationPopup,
useDetailPopup: useDetailPopup,
calendars: CalendarList,
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 format ? currentDate.format(format) : currentDate;
}

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 c233b6c

Please sign in to comment.