Skip to content

Commit

Permalink
Fix calendar dates
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Apr 13, 2024
1 parent aa79983 commit fd5d7c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/Domain/Comments/Repositories/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function addComment($values, $module): false|string
$stmn->bindValue(':commentParent', $values['commentParent'], PDO::PARAM_INT);
$stmn->bindValue(':text', $values['text'], PDO::PARAM_STR);
$stmn->bindValue(':module', $module, PDO::PARAM_STR);
$stmn->bindValue(':date', date("Y-m-d H:i:s"), PDO::PARAM_STR);
$stmn->bindValue(':date', $values["date"], PDO::PARAM_STR);
$stmn->bindValue(':status', $values['status'] ?? '', PDO::PARAM_STR);

$result = $stmn->execute();
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Comments/Services/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function addComment($values, $module, $entityId, $entity): bool
if (isset($values['text']) && $values['text'] != '' && isset($values['father']) && isset($module) && isset($entityId) && isset($entity)) {
$mapper = array(
'text' => $values['text'],
'date' => date("Y-m-d H:i:s"),
'date' => $values["date"] ?? dtHelper()->dbNow()->formatDateTimeForDb(),
'userId' => ($_SESSION['userdata']['id']),
'moduleId' => $entityId,
'commentParent' => ($values['father']),
Expand Down
26 changes: 15 additions & 11 deletions app/Domain/Tickets/Templates/calendar.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,15 @@

title: <?php echo json_encode($headline); ?>,

start: <?php echo "'" . (($mlst->editFrom != '0000-00-00 00:00:00' && !str_starts_with(
$mlst->editFrom,
'1969-12-31'
)) ? $mlst->editFrom : date('Y-m-d', strtotime("+1 day", time()))) . "',"; ?>
<?php if (isset($mlst->editTo)) : ?>
end: <?php echo "'" . (($mlst->editTo != '0000-00-00 00:00:00' && !str_starts_with(
$mlst->editTo,
'1969-12-31'
)) ? $mlst->editTo : date('Y-m-d', strtotime("+1 day", time()))) . "',"; ?>
<?php endif; ?>
<?php if(dtHelper()->isValidDateString($mlst->dateToFinish)){ ?>
start: new Date(<?php echo format($mlst->dateToFinish)->jsTimestamp() ?>),
end: new Date(<?php echo format(dtHelper()->parseDbDateTime($mlst->dateToFinish)->addHour(1))->jsTimestamp() ?>),
<?php } elseif(dtHelper()->isValidDateString($mlst->editFrom)){ ?>
start: new Date(<?php echo format($mlst->editFrom)->jsTimestamp() ?>),
end: new Date(<?php echo format($mlst->editTo)->jsTimestamp() ?>),
<?php } ?>


enitityId: <?php echo $mlst->id ?>,
<?php if ($mlst->type == "milestone") { ?>
url: '#/tickets/editMilestone/<?php echo $mlst->id ?>',
Expand All @@ -160,13 +159,18 @@
const calendarEl = document.getElementById('calendar');

const calendar = new FullCalendar.Calendar(calendarEl, {
timeZone: leantime.i18n.__("usersettings.timezone"),

height:heightWindow,
initialView: '<?=$_SESSION['submenuToggle']["myProjectCalendarView"] ?>',
events: events,
editable: true,
headerToolbar: false,
dayHeaderFormat: leantime.dateHelper.getFormatFromSettings("dateformat", "luxon"),
eventTimeFormat: leantime.dateHelper.getFormatFromSettings("timeformat", "luxon"),
slotLabelFormat: leantime.dateHelper.getFormatFromSettings("timeformat", "luxon"),

nowIndicator: true,
nowIndicator: true,
bootstrapFontAwesome: {
close: 'fa-times',
prev: 'fa-chevron-left',
Expand Down

0 comments on commit fd5d7c4

Please sign in to comment.