Lines 137-148
cmp_ok( $dt0->epoch(), 'eq', '1325462399', 'dt_from_string handles seconds with
Link Here
|
137 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999+02:00', 'rfc3339' ); |
137 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999+02:00', 'rfc3339' ); |
138 |
cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with 3 decimal places and a timezone' ); |
138 |
cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with 3 decimal places and a timezone' ); |
139 |
|
139 |
|
140 |
try { |
140 |
eval { |
141 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999Z+02:00', 'rfc3339' ); |
141 |
$dt0 = dt_from_string( '2012-01-01T23:59:59.999Z+02:00', 'rfc3339' ); |
142 |
} |
|
|
143 |
catch { |
144 |
like( $_, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); |
145 |
}; |
142 |
}; |
|
|
143 |
like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); |
146 |
|
144 |
|
147 |
# Return undef if passed mysql 0 dates |
145 |
# Return undef if passed mysql 0 dates |
148 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
146 |
$dt0 = dt_from_string( '0000-00-00', 'iso' ); |
149 |
- |
|
|