X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2FTimestamp.phpt;h=88ca90f0d1fdee7709b1dd6740acec2340e31a18;hb=HEAD;hp=1b4a222381d46187aa518cc9e4dcaf73fc7a502d;hpb=0272ce4a9b54b22f3f39e3b8dd2043ade3f3b697;p=awesomized%2Fext-ion diff --git a/tests/Timestamp.phpt b/tests/Timestamp.phpt index 1b4a222..88ca90f 100644 --- a/tests/Timestamp.phpt +++ b/tests/Timestamp.phpt @@ -14,12 +14,14 @@ try { } catch (Throwable) { echo "caught empty\n"; } -$full = "2021-12-07T14:08:51+00:00"; +$full = "2021-12-07T14:08:51.123456+00:00"; var_dump($t=new Timestamp(Timestamp\Precision::Day, datetime:$full),(string)$t); var_dump($t=new Timestamp(Timestamp\Precision::Day->value, datetime:$full),(string)$t); var_dump($t=new Timestamp(Timestamp\Precision::Min, datetime:"2020-10-01"),(string)$t); +$t->setTimezone(new DateTimeZone("Europe/Helsinki")); +var_dump((string) $t); var_dump($t=new Timestamp(Timestamp\Precision::Day, "!Y-m", "2000-10"),(string)$t); - +var_dump($t=new Timestamp(Timestamp\Precision::MinTZ, Timestamp\Format::MinTZ, "2000-10-20T11:11CET"),(string)$t); var_dump(ion\unserialize(ion\serialize(clone new ion\Timestamp(ion\Timestamp\Precision::Sec, DateTime::RFC3339, "1971-02-03T04:05:06Z")))); ?> DONE @@ -32,7 +34,7 @@ object(ion\Timestamp)#%d (5) { ["format"]=> string(7) "Y-m-d\T" ["date"]=> - string(26) "2021-12-07 14:08:51.000000" + string(26) "2021-12-07 14:08:51.123456" ["timezone_type"]=> int(1) ["timezone"]=> @@ -45,7 +47,7 @@ object(ion\Timestamp)#%d (5) { ["format"]=> string(7) "Y-m-d\T" ["date"]=> - string(26) "2021-12-07 14:08:51.000000" + string(26) "2021-12-07 14:08:51.123456" ["timezone_type"]=> int(1) ["timezone"]=> @@ -56,7 +58,7 @@ object(ion\Timestamp)#%d (5) { ["precision"]=> int(23) ["format"]=> - string(11) "Y-m-d\TH:iP" + string(10) "Y-m-d\TH:i" ["date"]=> string(26) "2020-10-01 00:00:00.000000" ["timezone_type"]=> @@ -64,7 +66,8 @@ object(ion\Timestamp)#%d (5) { ["timezone"]=> string(3) "CET" } -string(22) "2020-10-01T00:00+02:00" +string(16) "2020-10-01T00:00" +string(16) "2020-10-01T01:00" object(ion\Timestamp)#%d (5) { ["precision"]=> int(7) @@ -78,11 +81,24 @@ object(ion\Timestamp)#%d (5) { string(3) "CET" } string(11) "2000-10-01T" -object(ion\Timestamp)#8 (3) { +object(ion\Timestamp)#%d (5) { + ["precision"]=> + int(151) + ["format"]=> + string(11) "Y-m-d\TH:iP" + ["date"]=> + string(26) "2000-10-20 11:11:00.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "CET" +} +string(22) "2000-10-20T11:11+01:00" +object(ion\Timestamp)#%d (3) { ["precision"]=> int(55) ["format"]=> - string(13) "Y-m-d\TH:i:sP" + string(12) "Y-m-d\TH:i:s" ["date"]=> string(26) "1971-02-03 04:05:06.000000" }