What happened?
The Nightscout segment silently fails (returns disabled) when the Nightscout API returns a floating-point date field (e.g. 1770512410938.386) instead of an integer.
Some Nightscout providers (e.g. T1Pal) now return enriched entries where the date field includes fractional milliseconds. Go's json.Unmarshal cannot decode a float into the current int64 field, so the entire JSON parse fails and Enabled() returns false.
How to reproduce
Use a Nightscout URL that returns a response like:
[{"sgv":124,"date":1770512410938.386,"direction":"Flat",...}]
The segment will not render.
Expected behavior
The segment should handle both integer and floating-point date values.
Proposed fix
Change Date int64 to Date float64 in the NightscoutData struct. This is backward compatible - Go's JSON decoder can unmarshal integer JSON numbers into float64 without issues.
PR: #7285
Environment
- Oh My Posh version: 28.8.1 (also confirmed in latest main)
- OS: Windows
- Shell: PowerShell 7.5.4
What happened?
The Nightscout segment silently fails (returns disabled) when the Nightscout API returns a floating-point
datefield (e.g.1770512410938.386) instead of an integer.Some Nightscout providers (e.g. T1Pal) now return enriched entries where the
datefield includes fractional milliseconds. Go'sjson.Unmarshalcannot decode a float into the currentint64field, so the entire JSON parse fails andEnabled()returnsfalse.How to reproduce
Use a Nightscout URL that returns a response like:
[{"sgv":124,"date":1770512410938.386,"direction":"Flat",...}]The segment will not render.
Expected behavior
The segment should handle both integer and floating-point
datevalues.Proposed fix
Change
Date int64toDate float64in theNightscoutDatastruct. This is backward compatible - Go's JSON decoder can unmarshal integer JSON numbers intofloat64without issues.PR: #7285
Environment