Skip to content

fix: handle >6-digit fractional seconds in ISO timestamps on Windows#257

Merged
MaojiaSheng merged 1 commit intovolcengine:mainfrom
haosenwang1018:fix/windows-7digit-microsecond-isoformat
Feb 23, 2026
Merged

fix: handle >6-digit fractional seconds in ISO timestamps on Windows#257
MaojiaSheng merged 1 commit intovolcengine:mainfrom
haosenwang1018:fix/windows-7digit-microsecond-isoformat

Conversation

@haosenwang1018
Copy link
Contributor

Problem

On Windows, ls fails with:

ValueError: Invalid isoformat string: '2026-02-21T13:20:23.1470042+08:00'

Windows generates ISO timestamps with 7-digit fractional seconds, but Python's datetime.fromisoformat() only supports up to 6 digits.

Fix

Add a parse_iso_datetime() helper in time_utils.py that truncates excess fractional digits before parsing. Replace the two datetime.fromisoformat() calls in viking_fs.py with this helper.

Fixes #242

Windows may produce ISO 8601 timestamps with 7-digit fractional
seconds (e.g. .1470042), which Python's datetime.fromisoformat()
rejects with ValueError. Add a parse_iso_datetime() helper that
truncates excess digits before parsing.

Fixes volcengine#242

Signed-off-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@MaojiaSheng MaojiaSheng merged commit b606097 into volcengine:main Feb 23, 2026
4 of 6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: ValueError: Invalid isoformat string on Windows due to high-precision timestamps

4 participants