Add DateTimeFormat enum

This commit is contained in:
Alex Cabal 2024-11-08 16:41:15 -06:00
parent be5574eaec
commit c35c47b793
18 changed files with 38 additions and 26 deletions

View file

@ -35,7 +35,7 @@ catch(Exceptions\AppException){
<p><?= $poll->Description ?></p>
<? if($poll->IsActive()){ ?>
<? if($poll->End !== null){ ?>
<p class="center-notice">This poll closes on <?= $poll->End->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">This poll closes on <?= $poll->End->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<? } ?>
<? if(!$canVote){ ?>
<p class="center-notice">Youve already voted in this poll.</p>
@ -48,9 +48,9 @@ catch(Exceptions\AppException){
</p>
<? }else{ ?>
<? if($poll->Start !== null && $poll->Start > NOW){ ?>
<p class="center-notice">This poll opens on <?= $poll->Start->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">This poll opens on <?= $poll->Start->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<? }else{ ?>
<p class="center-notice">This poll closed on <?= $poll->End->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">This poll closed on <?= $poll->End->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<p class="button-row narrow"><a href="<?= $poll->Url ?>/votes" class="button">View results</a></p>
<? } ?>
<? } ?>

View file

@ -26,7 +26,7 @@ catch(Exceptions\AppException){
<? if($created){ ?>
<p class="center-notice">Thank you for voting in the <a href="<?= $vote->PollItem->Poll->Url ?>"><?= Formatter::EscapeHtml($vote->PollItem->Poll->Name) ?> poll</a>.</p>
<? }else{ ?>
<p class="center-notice">Your vote in the <a href="<?= $vote->PollItem->Poll->Url ?>"><?= Formatter::EscapeHtml($vote->PollItem->Poll->Name) ?> poll</a> was submitted on <?= $vote->Created->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">Your vote in the <a href="<?= $vote->PollItem->Poll->Url ?>"><?= Formatter::EscapeHtml($vote->PollItem->Poll->Name) ?> poll</a> was submitted on <?= $vote->Created->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<? } ?>
<p class="button-row narrow"><a class="button" href="<?= $vote->PollItem->Poll->Url ?>/votes"> view results</a></p>
</section>

View file

@ -15,10 +15,10 @@ catch(Exceptions\AppException){
<p class="center-notice">Total votes: <?= number_format($poll->VoteCount) ?></p>
<? if($poll->IsActive()){ ?>
<? if($poll->End !== null){ ?>
<p class="center-notice">This poll closes on <?= $poll->End->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">This poll closes on <?= $poll->End->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<? } ?>
<? }elseif($poll->End !== null){ ?>
<p class="center-notice">This poll closed on <?= $poll->End->format('F j, Y g:i a') ?>.</p>
<p class="center-notice">This poll closed on <?= $poll->End->format(Enums\DateTimeFormat::FullDateTime->value) ?>.</p>
<? } ?>
<table class="votes">
<tbody>