fix day cycle error
This commit is contained in:
@@ -42,7 +42,7 @@ times: [2, times]
|
||||
function ccn_datetime_ResolveLoopRules4UI(strl) {
|
||||
if (strl == '') return undefined;
|
||||
|
||||
sp = strl.split('-');
|
||||
var sp = strl.split('-');
|
||||
if (sp.length != 2) return undefined;
|
||||
var loopRules = undefined;
|
||||
var loopStopRules = undefined;
|
||||
@@ -81,12 +81,12 @@ function ccn_datetime_ResolveLoopRules4UI(strl) {
|
||||
// in this section, all time should be analysed with Date((time + timezoneOffset) * 60000)
|
||||
// and use .getUTC...() functions.
|
||||
function ccn_datetime_ResolveLoopRules4Event(loopRules, loopDateTimeStart, loopDateTimeEnd, eventDateTimeStart, eventDateTimeEnd, timezoneOffset, clampStartDateTime) {
|
||||
if (strl == '') return [
|
||||
if (loopRules == '') return [
|
||||
[Math.max(eventDateTimeStart, clampStartDateTime),
|
||||
Math.max(loopDateTimeEnd, eventDateTimeEnd)]
|
||||
];
|
||||
|
||||
sp = strl.split('-');
|
||||
var sp = loopRules.split('-');
|
||||
if (sp.length != 2) return undefined;
|
||||
var loopRules = sp[0]; // we don't need consider stop flag
|
||||
var result = new Array();
|
||||
@@ -219,11 +219,14 @@ function ccn_datetime_ResolveLoopRules4Event(loopRules, loopDateTimeStart, loopD
|
||||
} else if (ccn_datetime_precompiledLoopRules.day.test(loopRules)) {
|
||||
var loopSpan = parseInt(RegExp.$1);
|
||||
|
||||
detectDateTime.setUTCDate(
|
||||
(ccn_datetime_DaysCount(detectDateTime.getUTCFullYear(), detectDateTime.getUTCMonth() + 1, detectDateTime.getDate()) -
|
||||
ccn_datetime_DaysCount(originalYear, originalMonth, originalDay)) % loopSpan +
|
||||
detectDateTime.getUTCDate()
|
||||
);
|
||||
var daysCount = ccn_datetime_DaysCount(detectDateTime.getUTCFullYear(), detectDateTime.getUTCMonth() + 1, detectDateTime.getDate()) -
|
||||
ccn_datetime_DaysCount(originalYear, originalMonth, originalDay);
|
||||
var fullSpanCount = Math.floor(daysCount / loopSpan);
|
||||
var remainDays = daysCount % loopSpan;
|
||||
detectDateTime.setUTCDate(fullSpanCount * loopSpan + detectDateTime.getUTCDate());
|
||||
if (remainDays != 0)
|
||||
detectDateTime.setUTCDate(loopSpan - remainDays + detectDateTime.getUTCDate());
|
||||
|
||||
while(Math.floor(detectDateTime.getTime() / 60000) + eventOffset - timezoneOffset <= loopDateTimeEnd) {
|
||||
result.push(
|
||||
[Math.floor(detectDateTime.getTime() / 60000) + eventOffset - timezoneOffset,
|
||||
|
||||
@@ -106,8 +106,8 @@ function ccn_calendar_calendar_Analyse() {
|
||||
ccn_calendar_calendar_displayCache.push({
|
||||
month: gottenDateTime.getMonth() + 1,
|
||||
day: gottenDateTime.getDate(),
|
||||
dayOfWeek: gottenDateTime.getWeekday(),
|
||||
subcalendar: " ",
|
||||
dayOfWeek: gottenDateTime.getWeekday() + 1,
|
||||
subcalendar: " -",
|
||||
events: new Array()
|
||||
});
|
||||
gottenDateTime.setTime(gottenDateTime.getTime() + ccn_datetime_DAY1_SPAN * 60000);
|
||||
@@ -132,12 +132,13 @@ function ccn_calendar_calendar_Analyse() {
|
||||
var it = result[i];
|
||||
// try get event belong to which cell
|
||||
var eventDateTime = new Date(it[0] * 60000);
|
||||
var count = Math.floor((eventDateTime - startTimestamp) / ccn_datetime_DAY1_SPAN);
|
||||
var count = Math.floor((it[0] - startTimestamp) / ccn_datetime_DAY1_SPAN);
|
||||
var exitFlag = false;
|
||||
// then split event
|
||||
while(count < 6 * 7) {
|
||||
var eventItem = {
|
||||
uuid: item[0],
|
||||
belongTo: item[1],
|
||||
title: item[2],
|
||||
description: item[3],
|
||||
isVisible: true,
|
||||
@@ -148,11 +149,11 @@ function ccn_calendar_calendar_Analyse() {
|
||||
end: undefined // filled in follwing code
|
||||
}
|
||||
eventDateTime.setHours(23, 59, 0, 0);
|
||||
if (Math.floor(eventDateTime.getTime() / 60000) <= it[1]) {
|
||||
if (Math.floor(eventDateTime.getTime() / 60000) > it[1]) {
|
||||
exitFlag = true;
|
||||
eventDateTime.setTime(it[1] * 60000);
|
||||
}
|
||||
eventDateTime.end = eventDateTime.toLocaleTimeString();
|
||||
eventItem.end = eventDateTime.toLocaleTimeString();
|
||||
ccn_calendar_calendar_displayCache[count].events.push(eventItem);
|
||||
if (exitFlag) break;
|
||||
count++;
|
||||
@@ -171,9 +172,9 @@ function ccn_calendar_calendar_Render() {
|
||||
for(var i = 0; i < 6; i++) {
|
||||
for(var j = 0; j < 7; j++) {
|
||||
var item = ccn_calendar_calendar_displayCache[counter];
|
||||
$('#ccn-calendarItem-title' + i + '-' + j).text(item.day);
|
||||
$('#ccn-calendarItem-desc' + i + '-' + j).text(item.subcalendar);
|
||||
$('#ccn-calendarItem-task' + i + '-' + j).text(item.events.length);
|
||||
$('#ccn-calendarItem-title-' + i + '-' + j).text(item.day);
|
||||
$('#ccn-calendarItem-desc-' + i + '-' + j).text(item.subcalendar);
|
||||
$('#ccn-calendarItem-task-' + i + '-' + j).text(item.events.length.toString());
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
@@ -184,13 +185,13 @@ function ccn_calendar_calendar_Render() {
|
||||
for(var i in ccn_calendar_calendar_displayCache) {
|
||||
for(var j in ccn_calendar_calendar_displayCache[i].events) {
|
||||
var gottenOwnedVisible = ccn_calendar_owned_displayCache[
|
||||
ccn_calendar_calendar_displayCache[i].events[j].uuid
|
||||
ccn_calendar_calendar_displayCache[i].events[j].belongTo
|
||||
];
|
||||
if (typeof(gottenOwnedVisible) != 'undefined') gottenOwnedVisible = false;
|
||||
if (typeof(gottenOwnedVisible) == 'undefined') gottenOwnedVisible = false;
|
||||
var gottenSharedVisible = ccn_calendar_shared_displayCache[
|
||||
ccn_calendar_calendar_displayCache[i].events[j].uuid
|
||||
ccn_calendar_calendar_displayCache[i].events[j].belongTo
|
||||
];
|
||||
if (typeof(gottenSharedVisible) != 'undefined') gottenSharedVisible = false;
|
||||
if (typeof(gottenSharedVisible) == 'undefined') gottenSharedVisible = false;
|
||||
|
||||
ccn_calendar_calendar_displayCache[i].events[j].isVisible = gottenOwnedVisible || gottenSharedVisible;
|
||||
}
|
||||
@@ -213,6 +214,8 @@ function ccn_calendar_calendar_btnToday() {
|
||||
var nowtime = new Date();
|
||||
ccn_datetimepicker_Set(1, nowtime, false);
|
||||
ccn_calendar_calendar_Refresh();
|
||||
ccn_calendar_calendar_Analyse();
|
||||
ccn_calendar_calendar_Render();
|
||||
}
|
||||
|
||||
function ccn_calendar_calendar_btnAdd() {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="ccn-calendarItem-{{:~row}}-{{:~column}}">
|
||||
<p><b id="ccn-calendarItem-title-{{:~row}}-{{:~column}}"> </b></p>
|
||||
<p><small id="ccn-calendarItem-desc-{{:~row}}-{{:~column}}"> </small></p>
|
||||
<p><span class="icon is-small"><i class="fas fa-tasks"></i></span id="ccn-calendarItem-task-{{:~row}}-{{:~column}}"> </p>
|
||||
<p><span class="icon is-small"><i class="fas fa-tasks"></i></span><span id="ccn-calendarItem-task-{{:~row}}-{{:~column}}"> </span></p>
|
||||
</div>
|
||||
{{/for}}
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{{for renderdata}}
|
||||
<div class="schedule-day container">
|
||||
<div class="schedule-day-words">
|
||||
<b>{{>month}}</b>
|
||||
<b i18n-name="ccn-i18n-universal-month-{{:month}}"></b>
|
||||
<b>{{>day}}</b>
|
||||
<b i18n-name="ccn-i18n-universal-week-{{:dayOfWeek}}"></b>
|
||||
</div>
|
||||
<div class="schedule-event-list">
|
||||
{{for event}}
|
||||
{{for events}}
|
||||
{{if isVisible}}
|
||||
<div class="schedule-event card">
|
||||
<div class="schedule-event-words">
|
||||
|
||||
@@ -89,94 +89,6 @@
|
||||
<h1 i18n-name="ccn-i18n-calendar-calendar-scheduleList" class="title"></h1>
|
||||
|
||||
<div id="ccn-calendar-scheduleList">
|
||||
<div class="schedule-day container">
|
||||
<div class="schedule-day-words">
|
||||
<b>13</b>
|
||||
<b>Friday</b>
|
||||
</div>
|
||||
<div class="schedule-event-list">
|
||||
<div class="schedule-event card">
|
||||
<div class="schedule-event-words">
|
||||
<p class="level-item"><b>This is
|
||||
titleewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</b>
|
||||
</p>
|
||||
<p class="level-item">this is
|
||||
subtitleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event-icon">
|
||||
<span class="icon is-small"><i class="fas fa-lock"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event card">
|
||||
<div class="schedule-event-words">
|
||||
<p class="level-item"><b>This is
|
||||
titleewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</b>
|
||||
</p>
|
||||
<p class="level-item">this is
|
||||
subtitleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event-icon">
|
||||
<span class="icon is-small"><i class="fas fa-lock"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="schedule-day container">
|
||||
<div class="schedule-day-words">
|
||||
<b>13</b>
|
||||
<b>Friday</b>
|
||||
</div>
|
||||
<div class="schedule-event-list">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="schedule-day container">
|
||||
<div class="schedule-day-words">
|
||||
<b>13</b>
|
||||
<b>Friday</b>
|
||||
</div>
|
||||
<div class="schedule-event-list">
|
||||
<div class="schedule-event card">
|
||||
<div class="schedule-event-words">
|
||||
<p class="level-item"><b>This is
|
||||
titleewwwwwwwwwwwwwwwwww</b>
|
||||
</p>
|
||||
<p class="level-item">this is
|
||||
subtitleeeeeeeeeewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwweeeeeeeeeeeeeeeeeeeeee
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event-icon">
|
||||
<span class="icon is-small"><i class="fas fa-lock"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event card">
|
||||
<div class="schedule-event-words">
|
||||
<p class="level-item"><b>This is
|
||||
titleeww</b>
|
||||
</p>
|
||||
<p class="level-item">this is
|
||||
subtitleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="schedule-event-icon">
|
||||
<span class="icon is-small"><i class="fas fa-lock"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user