Skip to content

fix $toMillis() with more than 3 digit fractional seconds#782

Merged
mattbaileyuk merged 1 commit intomasterfrom
millis_fix
Apr 30, 2026
Merged

fix $toMillis() with more than 3 digit fractional seconds#782
mattbaileyuk merged 1 commit intomasterfrom
millis_fix

Conversation

@andrew-coleman
Copy link
Copy Markdown
Member

The factional part of the date/time seconds was being parsed and converted to an integer in order to pass to the milliseconds parameter. However, if there were more than 3 digits, then this would be more than a thousand and spill over into the seconds (and possible minutes).
Moreover, if the fractional part started with a zero, this would get lost in the conversion to an integer. This commit fixes the parsing and truncates the value to max 3 digits (milliseconds is the finest resolution supported).

resolves #778

The factional part of the date/time seconds was being parsed
and converted to an integer in order to pass to the
milliseconds parameter. However, if there were more than
3 digits, then this would be more than a thousand and spill over
into the seconds (and possible minutes).
Moreover, if the fractional part started with a zero, this would get lost in the conversion to an integer.
This commit fixes the parsing and truncates the value to max 3 digits (milliseconds is the finest resolution supported).

Signed-off-by: Andrew Coleman <andrew_coleman@uk.ibm.com>
@mattbaileyuk mattbaileyuk merged commit 80ba95d into master Apr 30, 2026
9 checks passed
@mattbaileyuk mattbaileyuk deleted the millis_fix branch April 30, 2026 16:13
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.

toMillis returns incorrect timestamp with more then 3 digits in fractional seconds

2 participants