creepymonster / nightscout-to-libreview

Transfer your diabetes data from Nightscout to LibreView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change time format

inxaile opened this issue · comments

Hello.
Thank you very much for the script.
Please tell me, when uploading from Nightscout, the date format is UTC and, accordingly, Libreview is uploading in the same time format.
What needs to be changed in order for Libreview to load at GMT+3 ?

Example export string from Nightscout

{"_id":"hYjKsBYSMNZ0U7kmovLxhtrv","unfiltered":131000,"sysTime":"2023-05-30T07:06:47.119Z","type":"sgv","filtered":131000,"sgv":131,"device":"Bubble Mini","date":1685430407119,"noise":1,"dateString":"2023-05-30T07:06:47.119Z","direction":"FortyFiveUp","utcOffset":0},{"_id":"vE4yP9JngFQUhgdRjuQ5tZHT","sysTime":"2023-05-30T07:01:47.119Z","dateString":"2023-05-30T07:01:47.119Z","sgv":124,"noise":1,"type":"sgv","unfiltered":124000,"device":"Bubble Mini","direction":"Flat","filtered":124000,"date":1685430107119,"utcOffset":0},{"_id":"LYKhn1vLf26wkb70bgAlgKne","unfiltered":121000,"sysTime":"2023-05-30T06:56:37.390Z","type":"sgv","filtered":121000,"sgv":121,"device":"Bubble Mini","date":1685429797390,"noise":1,"dateString":"2023-05-30T06:56:37.390Z","direction":"FortyFiveUp","utcOffset":0}

I have the same issue. During British summer time, when we are on UTC +1, treatments load into libreview and show 1 hour earlier than the local time.

It seems possible that I could change the Heroku dyno timezone to Europe/London which I guess would have the effect of populating the utcOffset in the above example.

The Heroku help says. Changing your dynos timezone is not usually a good idea. Best practice would be to store/use time in UTC and instead convert the UTC time as appropriate at the view layer/client side for display only.

Hello, @inxaile and @darenfit!
When exporting, we specify the time in UTC format in the “factoryTimestamp” parameter, and the time with the time zone in the “timestamp” parameter.

Example:

{
        "extendedProperties": {
                "highOutOfRange": "false",
                "canMerge": "true",
                "isFirstAfterTimeChange": false,
                "factoryTimestamp": "2023-12-05T11:46:21.000Z",
                "lowOutOfRange": "false"
        },
        "recordNumber": "120231205114621",
        "timestamp": "2023-12-05T14:46:21.000+03:00",
        "valueInMgPerDl": 100
}