Skip to content

Commit 23bcb43

Browse files
committed
Issues-342: use default full datetime format in postings
1 parent f37f794 commit 23bcb43

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

vanilla/applications/vanilla/views/categories/helper_functions.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php if (!defined('APPLICATION')) exit();
1+
<?php use Vanilla\Formatting\DateTimeFormatter;
2+
3+
if (!defined('APPLICATION')) exit();
24

35
if (!function_exists('CategoryHeading')):
46

@@ -121,8 +123,9 @@ function mostRecentString($row) {
121123

122124
$r .= '<span class="MostRecentOn">';
123125
$r .= t('on').' ';
126+
$dateFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($lastDate, false, DateTimeFormatter::FORCE_FULL_FORMAT);
124127
$r .= anchor(
125-
Gdn_Format::date( $lastDate, 'html'),
128+
$dateFormatted,
126129
$row['LastUrl'],
127130
'CommentDate');
128131
$r .= '</span>';

vanilla/applications/vanilla/views/discussions/helper_functions.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php if (!defined('APPLICATION')) exit();
1+
<?php use Vanilla\Formatting\DateTimeFormatter;
2+
3+
if (!defined('APPLICATION')) exit();
24

35
if (!function_exists('AdminCheck')) {
46
/**
@@ -204,11 +206,13 @@ function writeDiscussion($discussion, $sender, $session) {
204206
$sender->fireEvent('AfterCountMeta');
205207

206208
if ($discussion->LastDiscussionCommentsUserID != '') {
209+
$dateFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($lastDate, false, DateTimeFormatter::FORCE_FULL_FORMAT);
207210
echo ' <span class="MItem LastCommentBy">'.sprintf(t('Most recent by %1$s'), userAnchor($last)).'</span> ';
208-
echo ' <span class="MItem LastCommentDate">'.Gdn_Format::date($lastDate, 'html').'</span>';
211+
echo ' <span class="MItem LastCommentDate">'.$dateFormatted.'</span>';
209212
} else {
213+
$dateFormatted = Gdn::getContainer()->get(DateTimeFormatter::class)->formatDate($discussion->FirstDate, false, DateTimeFormatter::FORCE_FULL_FORMAT);
210214
echo ' <span class="MItem LastCommentBy">'.sprintf(t('Started by %1$s'), userAnchor($first)).'</span> ';
211-
echo ' <span class="MItem LastCommentDate">'.Gdn_Format::date($discussion->FirstDate, 'html');
215+
echo ' <span class="MItem LastCommentDate">'.$dateFormatted;
212216
if ($source = val('Source', $discussion)) {
213217
echo ' '.sprintf(t('via %s'), t($source.' Source', $source));
214218
}

0 commit comments

Comments
 (0)