Spomky-Labs / cbor-php

CBOR Encoder/Decoder for PHP
MIT License
42 stars 11 forks source link

Tag 0 EpochTag doesn't support all date formats #29

Closed MaximilianKresse closed 3 years ago

MaximilianKresse commented 3 years ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? / Specification no
Library version 2.0.1

https://github.com/Spomky-Labs/cbor-php/blob/v2.0.1/src/Tag/EpochTag.php#L43

The EpochTag class currently does only support "Y-m-d\TH:i:sP" (RFC3339).

Following the RFC7049 2.4.1 (CBOR) they reference to RFC4287 3.3 with the following example datetimes:

   <updated>2003-12-13T18:30:02Z</updated>
   <updated>2003-12-13T18:30:02.25Z</updated>
   <updated>2003-12-13T18:30:02+01:00</updated>
   <updated>2003-12-13T18:30:02.25+01:00</updated>

Currently only the first and third is supported.

Another thing - I think the class name "EpochTag" is wrong. "Epoch time" is another name for the unix time or timestamp: https://en.wikipedia.org/wiki/Unix_time The TimestampTag could have this name, but this tag should be named something like "DateTimeTag".

Spomky commented 3 years ago

I keep this issue opened as the PR #30 only addresses the first part, but not the class name issue.

Spomky commented 3 years ago

Hi @MaximilianKresse ,

The remaining comment is going to be addressed by #31.

I close this issue now. Feel free to open it or comment if needed. Regards

github-actions[bot] commented 7 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.