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

Casting DateTimeInterface: Truncate nanoseconds to microseconds (first 6 digits) / with Tests #908

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yob-yob
Copy link

@yob-yob yob-yob commented Dec 4, 2024

So I'm basically just making this pull request to fix a very specific issue I'm having.

a Third Party API i'm using is returning dates in ISO 8601 Format with Nanoseconds precision, but sadly PHP does not support nanoseconds (they only support up-to microseconds)

Example:
A provided datetime 2024-12-03T10:33:18.924711041Z is in ISO 8601 format with a nanosecond precision and a timezone indicator (Z for UTC). However, PHP's DateTime and the provided formats DATE_ATOM or Y-m-d\TH:i:s.u\Z do not handle nanoseconds (fractions of a second) by default, which is causing the error.

@yob-yob
Copy link
Author

yob-yob commented Dec 4, 2024

also... when I made a fresh new branch from main and ran pest...

There was some errors already on the test suite, am I required to fix those test to make this pull-request valid?

@yob-yob yob-yob changed the title Truncate nanoseconds to microseconds (first 6 digits) / with Tests Casting DateTimeInterface: Truncate nanoseconds to microseconds (first 6 digits) / with Tests Dec 4, 2024
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.

1 participant