fix: fix activity date viewed as one day before the event happened (#2241)

This commit is contained in:
Régis Freyd
2019-01-01 20:48:37 -05:00
committed by GitHub
parent 6c998d6816
commit df22670d98
4 changed files with 4 additions and 16 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ Enhancements:
Fixes:
*
* Fix activity date viewed as one day before the event happened
RELEASED VERSIONS:
+2 -3
View File
@@ -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) ?: '';
-11
View File
@@ -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.
*
+1 -1
View File
@@ -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() }}