computerminds/php-edtf

A library for getting information about EDTF formatted strings.

0.3.0 2024-02-01 14:20 UTC

This package is auto-updated.

Last update: 2024-10-30 15:59:31 UTC


README

Build Status

Usage

Use the factory to get instances of EDTFInfo:

$factory = new \ComputerMinds\EDTF\EDTFInfoFactory();
$dateInfo = $factory->create('1990-01');

Then you can call the various methods on the instance.

$valid = $dateInfo->isValid();
if ($valid) {
  $min = $dateInfo->getMin();
  $max = $dateInfo->getMax();
  // $min and $max are just standard PHP \DateTime instances.
  print $min->format('c');
}