Skip to content

Time is incorrectly encoded #41

Description

@uroshercog

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions