|
506 | 506 | + day_class |
507 | 507 | + '" id="dh-' |
508 | 508 | + rday.getTime() |
509 | | - + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '"> ' |
| 509 | + + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '"><div class="fn-label">' |
510 | 510 | + rday.getHours() |
511 | | - + '</div>'); |
| 511 | + + '</div></div>'); |
512 | 512 | } |
513 | 513 |
|
514 | 514 |
|
|
679 | 679 |
|
680 | 680 | for (var i = 0; i < range.length; i++) { |
681 | 681 | var rday = range[i]; |
682 | | - |
| 682 | + |
683 | 683 | // Fill years |
684 | 684 | if (rday.getFullYear() !== year) { |
685 | 685 | yearArr.push( |
|
713 | 713 | } |
714 | 714 |
|
715 | 715 | dayArr.push('<div class="row date ' + day_class + '" ' |
716 | | - + ' id="dh-' + tools.genId(rday.getTime()) + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '> ' |
| 716 | + + ' id="dh-' + tools.genId(rday.getTime()) + '" offset="' + i * tools.getCellSize() + '" repdate="' + rday.genRepDate() + '"> ' |
717 | 717 | + ' <div class="fn-label">' + rday.getDate() + '</div></div>'); |
718 | 718 | dowArr.push('<div class="row day ' + day_class + '" ' |
719 | 719 | + ' id="dw-' + tools.genId(rday.getTime()) + '" repdate="' + rday.genRepDate() + '"> ' |
|
733 | 733 | + tools.getCellSize() * daysInMonth + 'px"><div class="fn-label">' |
734 | 734 | + settings.months[month] |
735 | 735 | + '</div></div>'); |
736 | | - |
| 736 | + |
737 | 737 | var dataPanel = core.dataPanel(element, range.length * tools.getCellSize()); |
738 | 738 |
|
739 | 739 |
|
|
1522 | 1522 | parseTimeRange: function (from, to, scaleStep) { |
1523 | 1523 | var current = new Date(from); |
1524 | 1524 | var end = new Date(to); |
| 1525 | + |
| 1526 | + // GR: Fix begin |
| 1527 | + current.setMilliseconds(0); |
| 1528 | + current.setSeconds(0); |
| 1529 | + current.setMinutes(0); |
| 1530 | + current.setHours(0); |
| 1531 | + |
| 1532 | + end.setMilliseconds(0); |
| 1533 | + end.setSeconds(0); |
| 1534 | + if (end.getMinutes() > 0 || end.getHours() > 0) { |
| 1535 | + end.setMinutes(0); |
| 1536 | + end.setHours(0); |
| 1537 | + end.setTime(end.getTime() + (86400000)); // Add day |
| 1538 | + } |
| 1539 | + // GR: Fix end |
| 1540 | + |
1525 | 1541 | var ret = []; |
1526 | 1542 | var i = 0; |
1527 | 1543 | for(;;) { |
1528 | 1544 | var dayStartTime = new Date(current); |
1529 | 1545 | dayStartTime.setHours(Math.floor((current.getHours()) / scaleStep) * scaleStep); |
1530 | | - |
| 1546 | + |
1531 | 1547 | if (ret[i] && dayStartTime.getDay() !== ret[i].getDay()) { |
1532 | 1548 | // If mark-cursor jumped to next day, make sure it starts at 0 hours |
1533 | 1549 | dayStartTime.setHours(0); |
|
1544 | 1560 | } |
1545 | 1561 | */ |
1546 | 1562 |
|
1547 | | - current = ktkGetNextDate(current, scaleStep); |
| 1563 | + // GR Fix Begin |
| 1564 | + current = ktkGetNextDate(dayStartTime, scaleStep); |
| 1565 | + // GR Fix End |
1548 | 1566 |
|
1549 | 1567 | i++; |
1550 | | - }; |
1551 | | - |
| 1568 | + } |
| 1569 | + |
1552 | 1570 | return ret; |
1553 | 1571 | }, |
1554 | 1572 |
|
|
1591 | 1609 |
|
1592 | 1610 | // Deserialize a date from a string |
1593 | 1611 | dateDeserialize: function (dateStr) { |
1594 | | - //return eval("new" + dateStr.replace(/\//g, " ")); |
1595 | | - var date = eval("new" + dateStr.replace(/\//g, " ")); |
1596 | | - return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes()); |
| 1612 | + var newDate = new Date(); |
| 1613 | + newDate.setTime(dateStr.replace(/[^0-9]/g, "")); |
| 1614 | + return newDate; |
1597 | 1615 | }, |
1598 | 1616 |
|
1599 | 1617 | // Generate an id for a date |
@@ -1734,5 +1752,5 @@ function ktkGetNextDate(currentDate, scaleStep) { |
1734 | 1752 |
|
1735 | 1753 | // If code reaches here, it's because current didn't really increment (invalid local time) because of daylight-saving adjustments |
1736 | 1754 | // => retry adding 2, 3, 4 hours, and so on (until nextDate > current) |
1737 | | - } |
| 1755 | + } |
1738 | 1756 | } |
0 commit comments