as_datetime: Set upper limit#193
Conversation
* Set upper limit to avoid overflowerror Fixes: ansible-collections#182 Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 24s |
jborean93
left a comment
There was a problem hiding this comment.
We should also update the documentation to state that the max cap of a date is 9999-12-31T23:59:59.999999+0000 and any FILETIME value above that will be set to that.
| if isinstance(value, str): | ||
| value = int(value) | ||
|
|
||
| if value >= 9223372036854775807: # 2^63 - 1 |
There was a problem hiding this comment.
It looks like the max value supported is actually 2650467743999999999, any value beyond that represents a datetime after year 9999. You have to add 9 to the value below as that's 900 nanoseconds which you can't represent in the DateTime constructor but we essentially ignore that level of precision.
[DateTime]::new(9999, 12, 31, 23, 59, 59, 999, 999, 'Utc').ToUniversalTime().ToFileTime()
2650467743999999990| year=datetime.MAXYEAR, | ||
| month=12, | ||
| day=31, | ||
| tzinfo=datetime.timezone.utc, |
There was a problem hiding this comment.
We should probably set the time portion to the max and not just the date.
SUMMARY
Fixes: #182
Signed-off-by: Abhijeet Kasurde Akasurde@redhat.com
ISSUE TYPE