Skip to content

Commit 94fe571

Browse files
committed
Add toDateTime
1 parent df7e50e commit 94fe571

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Type/DateTimeValue.php

+10
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)