Skip to content

Commit 675dab8

Browse files
committed
Fixes timestamp.
1 parent b0f1dc6 commit 675dab8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/Timestamp.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,16 @@
22

33
class Timestamp extends RegexpAtom {
44
protected static $pattern = '/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|((?!-0{2}(:0{2})?)([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?)?$/';
5+
6+
/**
7+
* Sets the $value.
8+
* @param mixed $new_value
9+
* @return Atom $this
10+
*/
11+
public function setValue($new_value) {
12+
if (preg_match('/[-+]\d\d$/', $new_value)) {
13+
$new_value .= ':00';
14+
}
15+
return parent::setValue($new_value);
16+
}
517
}

0 commit comments

Comments
 (0)