Skip to content

Commit

Permalink
Improved BaseModel with date timezone support
Browse files Browse the repository at this point in the history
  • Loading branch information
libern committed Sep 17, 2016
1 parent b3ec0f6 commit 973f17e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Someline/Base/Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,9 @@ public function setAttribute($key, $value)
{

if ($this->timestamp_always_save_in_utc) {
// set to UTC only if Carbon
if ($value instanceof Carbon) {
$value->setTimezone('UTC');
} else if ($value && (in_array($key, $this->getDates()) || $this->isDateCastable($key))) {
$value = $this->fromDateTime($value);
$value->setTimezone('UTC');
}
}

Expand Down

0 comments on commit 973f17e

Please sign in to comment.