Skip to content

Commit

Permalink
Make datetime datatype match ISO-8601 with tz
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinai committed Apr 16, 2023
1 parent d7cdb41 commit ded7f80
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Model/DataType/DateTimeDataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ class DateTimeDataType implements DataTypeInterface
public function __construct(
DateTimeFormatterInterface $dateTimeFormatter,
ScopeConfigInterface $scopeConfig
)
{
) {
$this->dateTimeFormatter = $dateTimeFormatter;
$this->scopeConfig = $scopeConfig;
}

public function valueToTypeCode($value): ?string
{
return is_string($value) && preg_match('/^\d{4}-\d\d-\d\d[ T]\d\d:\d\d:\d\d$/', $value)
return is_string($value) && preg_match('/^\d{4}-\d\d-\d\d[ T]\d\d:\d\d:\d\d(?:\+\d\d:\d\d)?/', $value)
? self::TYPE_DATETIME
: null;
}
Expand Down

0 comments on commit ded7f80

Please sign in to comment.