fix: fix activity date viewed as one day before the event happened (#2241)
This commit is contained in:
@@ -10,7 +10,7 @@ Enhancements:
|
||||
|
||||
Fixes:
|
||||
|
||||
*
|
||||
* Fix activity date viewed as one day before the event happened
|
||||
|
||||
RELEASED VERSIONS:
|
||||
|
||||
|
||||
@@ -106,15 +106,14 @@ class DateHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a date according to the timezone of the user, in a short format
|
||||
* like "Oct 29, 1981".
|
||||
* Return a date in a short format like "Oct 29, 1981".
|
||||
*
|
||||
* @param Carbon $date
|
||||
* @return string
|
||||
*/
|
||||
public static function getShortDate($date)
|
||||
{
|
||||
$date = new Date($date, static::getTimezone());
|
||||
$date = new Date($date);
|
||||
$format = trans('format.short_date_year', [], Date::getLocale());
|
||||
|
||||
return $date->format($format) ?: '';
|
||||
|
||||
@@ -101,17 +101,6 @@ class Activity extends Model implements IsJournalableInterface
|
||||
return (new Parsedown())->text($this->description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date_it_happened field.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function getDateItHappenedAttribute($value)
|
||||
{
|
||||
return DateHelper::parseDateTime($value, DateHelper::getTimezone());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the summary for this activity.
|
||||
*
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@foreach($contact->activities as $activity)
|
||||
<li class="table-row" cy-name="activity-body-{{ $activity->id }}">
|
||||
<div class="table-cell date">
|
||||
{{ \App\Helpers\DateHelper::getShortDate($activity->date_it_happened) }}
|
||||
{{ App\Helpers\DateHelper::getShortDate($activity->date_it_happened) }}
|
||||
</div>
|
||||
<div class="table-cell">
|
||||
{{ $activity->getSummary() }}
|
||||
|
||||
Reference in New Issue
Block a user