forked from thephpleague/period
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
35 lines (31 loc) · 822 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
use League\Period\Sequence;
use League\Period\Period;
require 'vendor/autoload.php';
$sequenceA = new Sequence(
new Period('2000-01-01', '2000-01-10'),
new Period('2000-01-12', '2000-01-20')
);
$sequenceB = new Sequence(
new Period('2000-01-05', '2000-01-08'),
new Period('2000-01-11', '2000-01-25')
);
$diff = $sequenceA->substract($sequenceB);
dump(
count($diff),
$diff[0]->format('Y-m-d'),
$diff[1]->format('Y-m-d')
);
$sequenceA = new Sequence(
new Period('2000-01-01', '2000-01-10'),
new Period('2000-01-12', '2000-01-20')
);
$sequenceB = new Sequence();
$diff1 = $sequenceA->substract($sequenceB);
dump(
count($diff1),
$diff1->get(0)->format('Y-m-d'),
$diff1->get(1)->format('Y-m-d'),
count($sequenceB->substract($sequenceA))
);