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

Timestamp from Date fails with non-zero milliseconds #725

Closed
prowe opened this issue Oct 13, 2022 · 0 comments · Fixed by #726
Closed

Timestamp from Date fails with non-zero milliseconds #725

prowe opened this issue Oct 13, 2022 · 0 comments · Fixed by #726

Comments

@prowe
Copy link
Contributor

prowe commented Oct 13, 2022

If the Timestamp(Date) constructor is invoked with a Date that includes non-zero milliseconds then it will throw an error with the milliseconds out of range:

Error: Seconds 945 must be between 0 inclusive, and 60 exclusive

To reproduce:

it('constructor with Date that has milliseconds', () => {
      const date = new Date(2000, 0, 1, 12, 30, 45, 900);
      let timestamp = new ion.Timestamp(date);
      assert.equal(timestamp.getSecondsDecimal(), new ion.Decimal('45.900'));
});
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 a pull request may close this issue.

1 participant