Skip to content

Check if a datetime is in millis#3254

Merged
prathmesh-stripe merged 3 commits intomasterfrom
mbroshi/date-time-bug
Nov 18, 2025
Merged

Check if a datetime is in millis#3254
prathmesh-stripe merged 3 commits intomasterfrom
mbroshi/date-time-bug

Conversation

@mbroshi-stripe
Copy link
Copy Markdown
Contributor

@mbroshi-stripe mbroshi-stripe commented Nov 13, 2025

Why?

A bug was reported in #3253 where the Stripe API is returning a datetime in milliseconds instead of seconds. That's causing a ArgumentOutOfRangeException when trying to deserialize the last_seen_at field. This PR addresses that issue by detecting if a returned value is in millis or seconds before trying to deserialize it to a DateTime.

What?

  • Updates UnixDateTimeConverter and STJUnixDateTimeConverter to convert large values as milliseconds and smaller values as seconds.

See Also

Changelog

  • Bug fix for #3253. UnixDateTimeConverter now handles timestamps in milliseconds.

@prathmesh-stripe prathmesh-stripe marked this pull request as ready for review November 18, 2025 17:41
@prathmesh-stripe prathmesh-stripe merged commit 22ef731 into master Nov 18, 2025
7 of 8 checks passed
@prathmesh-stripe prathmesh-stripe deleted the mbroshi/date-time-bug branch November 18, 2025 17:56
@kerams
Copy link
Copy Markdown

kerams commented Nov 18, 2025

Why not convert all those DateTime into DateTimeOffset at long last, especially if you're releasing a major version.

@mbroshi-stripe
Copy link
Copy Markdown
Contributor Author

mbroshi-stripe commented Nov 19, 2025

Why not convert all those DateTime into DateTimeOffset at long last, especially if you're releasing a major version.

@kerams Thanks for the idea! Can you open an issue with that? That seems like a much bigger change, but we can consider it separately.

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.

4 participants