2017 © Pedro Peláez
 

library datetime-range

Provides capabilities to parse or build tstzranges for Postgres databases

image

inthere/datetime-range

Provides capabilities to parse or build tstzranges for Postgres databases

  • Monday, September 4, 2017
  • by InThere
  • Repository
  • 4 Watchers
  • 0 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

DateTimeRange

The Postgres database supports ranges. This package provides capabilities to parse or build tstzranges for Postgres databases. This package attempts to fully support all the features of the tstzrange type. We made an exception for null values, which are interpreted as "infinity"., (*1)

Installation

You can install the package via composer:, (*2)

composer require inthere/datetime-range, (*3)

Usage

$parser = new Parser(
    '["2015-08-14 16:07:28.956968+02","2018-08-14 16:07:28.956968+02"]',
     new DateTimeZone('UTC')
);
$dateTimeRange = $parser->parse();

This returns a DateTimeRange object, which can provide the lower and upper range:, (*4)

$lowerRange = $dateTimeRange->getLowerRange();
$upperRange = $dateTimeRange->getUpperRange();

A Range object will be returned which contains the date, the boundary and which knows if the range is "infinity":, (*5)

$lowerRange->isInfinity(); 
// returns a boolean

$lowerRange->getDateTime(); 
// returns a datetime object or null if infinity

$lowerRange->getBoundary(); 
// returns a boundary object

The Boundary object determines if the range is inclusive [] or exclusive () and if the range is lower or upper:, (*6)

$boundary = $lowerRange->getBoundary();

$boundary->isLower(); 
// returns a boolean (true = lower, false = upper)

$boundary->isInclusive(); 
// returns a boolean (true = inclusive, false = exclusive)

Tests

$ vendor/bin/phpunit, (*7)

Contributors

Contributions are welcome. We accept contributions via pull requests on Github., (*8)

License

The MIT License (MIT). Please see the License File for more information., (*9)

About InThere

InThere - "The training Through Gaming Company" - speeds up training your team and change processes by providing a micro-training concept based on serious games., (*10)

The Versions

04/09 2017

dev-master

9999999-dev

Provides capabilities to parse or build tstzranges for Postgres databases

  Sources   Download

The Development Requires

04/09 2017

1.1.0

1.1.0.0

Provides capabilities to parse or build tstzranges for Postgres databases

  Sources   Download

The Development Requires

28/08 2017

1.0.2

1.0.2.0

Provides capabilities to parse or build tstzranges for Postgres databases

  Sources   Download

The Development Requires

28/08 2017

1.0.1

1.0.1.0

Provides capabilities to parse or build tstzranges for Postgres databases

  Sources   Download

The Development Requires

25/08 2017

1.0.0

1.0.0.0

Provides capabilities to parse or build tstzranges for Postgres databases

  Sources   Download

The Development Requires