Skip to content

Commit

Permalink
Fixed #3748
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 29, 2019
1 parent 138a164 commit 551274e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft CMS 3.x

## Unreleased

### Fixed
- Fixed an error that occured when creating a Table field with a Date column. ([#3748](https://github.com/craftcms/cms/issues/3748))

## 3.1.6 - 2019-01-29

### Added
Expand Down
6 changes: 5 additions & 1 deletion src/helpers/DateTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DateTimeHelper
* - `timezone` – A [valid PHP timezone](http://php.net/manual/en/timezones.php). If set, this will override
* the assumed timezone per `$assumeSystemTimeZone`.
*
* @param mixed $value The value that should be converted to a DateTime object.
* @param string|int|array|null $value The value that should be converted to a DateTime object.
* @param bool $assumeSystemTimeZone Whether it should be assumed that the value was set in the system timezone if
* the timezone was not specified. If this is `false`, UTC will be assumed.
* @param bool $setToSystemTimeZone Whether to set the resulting DateTime object to the system timezone.
Expand All @@ -104,6 +104,10 @@ public static function toDateTime($value, bool $assumeSystemTimeZone = false, bo
return $value;
}

if (!$value) {
return false;
}

$defaultTimeZone = ($assumeSystemTimeZone ? Craft::$app->getTimeZone() : 'UTC');

if (is_array($value)) {
Expand Down

0 comments on commit 551274e

Please # to comment.