You are here

public function CalendarSystemsPoorMansGregorianCalendar::parse in Calendar Systems 8.3

Overrides CalendarSystemsInterface::parse

File

src/CalendarSystems/CalendarSystemsPoorMansGregorianCalendar.php, line 54
Fallback calendar implementation in case php-intl is not available.

Class

CalendarSystemsPoorMansGregorianCalendar

Namespace

Drupal\calendar_systems\CalendarSystems

Code

public function parse($value, $format) {
  $dt = DateTime::createFromFormat($format, $value);
  if (!$dt) {
    return FALSE;
  }
  $this
    ->setTimestamp($dt
    ->getTimestamp());
  return TRUE;
}