Skip to content

Fixing now() integer issue to return proper Unix epoch in milliseconds.#74

Merged
iObject merged 2 commits intoTKSS-Software:masterfrom
azatdev:now()_integer_issue
Apr 7, 2026
Merged

Fixing now() integer issue to return proper Unix epoch in milliseconds.#74
iObject merged 2 commits intoTKSS-Software:masterfrom
azatdev:now()_integer_issue

Conversation

@azatdev
Copy link
Copy Markdown

@azatdev azatdev commented Mar 30, 2026

Hello all!

While using rodash now() method I noticed some inconsistencies when comparing to true epoch time in milliseconds.

  • dateObj.AsSeconds() was not converted to milliseconds before the addition of dateObj.GetMilliseconds()
  • The returned Integer is not adequate for use as it is only capable of handling integers that are 11 digits long, whereas a true millisecond timestamp requires 13 digits.

I changed the function to reflect the changes needed as well as the unit test that tests it, although I am not sure if I did that correctly.

Please let me know if I made a mistake anywhere or if you'd like me to change anything.

Thanks!

P.S. Type declaration with & is necessary to coerce dateObj.asSeconds() to Longinteger, otherwise it's an Integer and we're back to the same problem.

Copy link
Copy Markdown
Collaborator

@TwitchBronBron TwitchBronBron 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 to me. @iObject ?

@iObject iObject merged commit f88da8c into TKSS-Software:master Apr 7, 2026
3 checks passed
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.

3 participants