Skip to content

Commit 8e5877e

Browse files
committed
Add toDateTime
1 parent 3bc3aad commit 8e5877e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Type/DateTimeValue.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\XML\Type;
66

7+
use DateTimeImmutable;
78
use DateTimeInterface;
89
use SimpleSAML\XML\Assert\Assert;
910
use SimpleSAML\XML\Exception\SchemaViolationException;
@@ -53,4 +54,13 @@ public static function fromDateTime(DateTimeInterface $value): static
5354
{
5455
return new static($value->format(static::DATETIME_FORMAT));
5556
}
57+
58+
59+
/**
60+
* @return \DateTimeImmutable
61+
*/
62+
public function toDateTime(): DateTimeImmutable
63+
{
64+
return new DateTimeImmutable($this->getValue());
65+
}
5666
}

0 commit comments

Comments
 (0)