Skip to content

Change timestamp format #106

@benfrancis

Description

@benfrancis

Utils.timestamp() currently generates timestamps in the following format:

2022-01-20T17:21:12+00:00

For some reason the default output of Date().toISOString() is modified so that it ends in "+00:00" rather than "Z". This is probably because that's the format used by the examples do in the Web Thing API specification.

The latest draft of the W3C WoT Profile specification constrains the date format so that it must end in "Z".

I therefore propose changing the timestamp method to return the raw output of Date().toISOString() rather than modify it, so that datestamps look like:

2011-10-05T14:48:00.000Z

Before doing this we should check if it breaks anything.

Also, double check that the milliseconds portion of the datestamp is expected by WoT Profile.

Note: These timestamps are used in action resources in the gateway's API to show the requested and completed times of an action, and also for the timestamps of events. I'm not really sure why the gateway uses this utility function from the add-on library and they can probably call Date().toISOString() directly instead. If this utility function isn't used anywhere else then it could probably just be removed.

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