Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add microseconds support to timestamp format #536

Conversation

NanoSector
Copy link
Contributor

Prior to this patch, this would require a custom constructor in the form of:

static fn(float | int $timestamp): DateTimeImmutable => new
DateTimeImmutable(sprintf("@%d", $timestamp)),

This bypasses the datetime format support of Valinor entirely. This is required because the library does not support floats as valid DateTimeInterface input values.

This PR adds support for floats and registers timestamp.microseconds (U.u) as a valid default format.

@NanoSector NanoSector force-pushed the feature/microsecond-support-for-datetime-timestamps branch from 8a0a7be to 7cf8cac Compare May 1, 2024 13:37
Prior to this patch, this would require a custom constructor in the form
of:

```php
static fn(float | int $timestamp): DateTimeImmutable => new
DateTimeImmutable(sprintf("@%d", $timestamp)),
```

This bypasses the datetime format support of Valinor entirely. This is
required because the library does not support floats as valid
DateTimeInterface input values.

This commit adds support for floats and registers timestamp.microseconds
(U.u) as a valid default format.
@romm romm force-pushed the feature/microsecond-support-for-datetime-timestamps branch from 7cf8cac to 780d342 Compare June 6, 2024 17:14
@romm
Copy link
Member

romm commented Jun 6, 2024

Excellent! Thanks you @NanoSector.

@romm romm enabled auto-merge (rebase) June 6, 2024 17:15
@romm romm merged commit 02bd2e5 into CuyZ:master Jun 6, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants