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

Expand dtype to int64 before converting to seconds #278

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

OrestZborowski-SIG
Copy link
Contributor

Avoids numeric overflow of DateScalar int32
Fixes #277

Avoids numeric overflow of DateScalar int32
Fixes #277
@OrestZborowski-SIG OrestZborowski-SIG requested review from ryan-gunderson and a team December 21, 2021 15:52
@@ -837,7 +837,7 @@ def strftime(self, format, dtype='O'):

'''
if isinstance(self, np.ndarray):
return np.asarray([dt.utcfromtimestamp(timestamp).strftime(format) for timestamp in self._fa* SECONDS_PER_DAY], dtype=dtype)
return np.asarray([dt.utcfromtimestamp(timestamp).strftime(format) for timestamp in self._fa.astype(np.int64) * SECONDS_PER_DAY], dtype=dtype)
else:
return dt.strftime(dt.utcfromtimestamp(self * SECONDS_PER_DAY), format)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering DateBase derives from FastArray and so is always an np.ndarray, I'm not sure how this statement could be reached, so not changing it.

Copy link
Contributor

@ryan-gunderson ryan-gunderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and the tests should help a lot.

@OrestZborowski-SIG OrestZborowski-SIG merged commit fe66cbc into master Dec 21, 2021
@OrestZborowski-SIG OrestZborowski-SIG deleted the fix-277-date.strftime branch December 21, 2021 17:52
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.

Date.strftime() fails for dates beyond 2038-01-19
2 participants