public function DatexIntlCalendar::parse in Datex 8
Overrides DatexInterface::parse
File
- src/
Datex/ DatexIntlCalendar.php, line 39
Class
Namespace
Drupal\datex\DatexCode
public function parse($value, $format) {
$pat = static::format2pattern($format);
$this->intlFormatter
->setPattern($pat);
try {
$timestamp = $this->intlFormatter
->parse($value);
$timestamp = intval($timestamp);
$this
->setTimestamp($timestamp);
if ($this
->format($format) !== $value) {
return FALSE;
}
} catch (\Exception $e) {
return FALSE;
}
return TRUE;
}