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

Time is incorrectly encoded #41

Open
uroshercog opened this issue May 11, 2019 · 0 comments
Open

Time is incorrectly encoded #41

uroshercog opened this issue May 11, 2019 · 0 comments

Comments

@uroshercog
Copy link

Issue
The time in the packets is not encoded in a way that the OER document under RFCs suggests:
If the millisecond part is zero, it MUST be left out. Trailing zeros in the millisecond part MUST be left out. (OER Notes)

Code to reproduce

import dateFormat = require('dateformat');

const fn = d => Buffer.from(dateFormat(d, "UTC:yyyymmddHHMMss.l'Z'")).toString();

console.log(fn(new Date('2017-08-28T18:32:00.000Z')));
console.log(fn(new Date('2017-08-28T18:32:00.010Z')));
console.log(fn(new Date('2017-08-28T18:32:00.100Z')));

Results
20170828183200.000Z should be 20170828183200Z
20170828183200.010Z should be 20170828183200.01Z
20170828183200.100Z should be 20170828183200.1Z

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

No branches or pull requests

1 participant