Download the PHP package nxmcz/date-time without Composer
On this page you can find all versions of the php package nxmcz/date-time. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package date-time
DateTime
An immutable class to deal with DateTime object used in Noxem
systems. Works perfectly with nette/forms as Date, DateTime form's field.
PHP 8.2 ready!!
Requirements
This library requires PHP 8.1 or later.
Usage
Noxem\DateTime\DT
Basic initialization of DT object. DT object is child of native DateTimeImmutable object with handles for modify date/time parts.
Library supports casting object into HTML's native input types
Comparation:
isFuture(): bool
We operating with future?
Noxem\DateTime\Difference
Difference formula can be imagined as x = a - b
, where a
is object which calling child method, formula example is x = $b->difference($a)
Difference class is accessible with method:
DT::create()->difference(DT $suspect)
Output of class is signed numbers. Where: positive numbers represent future, negative going back to future.
Sign of number | Example | Description |
---|---|---|
- | -5 | Past |
+ | +5 | Future |
Method withAbsolute()
ignores negative numbers on methods, difference will be always in positive numbers
Method is also immutable.
Noxem\DateTime\Overlap
Next method is for compare two objects if overlap or not.
Overlapping class handles only with one method (in future quantities increase). Description of interval overlap statements are presented in table below:
Step | Interval visualisation | Result |
---|---|---|
BORDERS | I I |
|
After | ██████ I I |
FALSE |
Start touching | ███████I I |
FALSE |
Start inside | ████I██ I |
TRUE |
Inside start touching | I███████████I███████ |
TRUE |
Enclosing start touching | I██████ I |
TRUE |
Enclosing | I █████ I |
TRUE |
Enclosing end touching | I ████I |
TRUE |
Exact match | I███████████I |
TRUE |
Inside | ████I███████████I██████ |
TRUE |
Inside end touching | ████I███████████I |
TRUE |
End inside | I ████I████████████ |
TRUE |
End touching | I I████████████ |
FALSE |
Before | I I ███████████ |
FALSE |
Exception
Bad DateTime format throws an exception which is children of InvalidArgumentException