Hey!
This is my second time trying to asking about this. My last post was "moderated" around a month ago, and I have been waiting, but no one seems to have approved it... and sadly the GitHub issues are disabled.
I have found a weird behavior with the JS SDK when encoding and then decoding (enhanced) altitude. In the following snippet, I encode and then decode the record message. The problem is that the altitude on the original message is not what gets saved when encoding.
import { Decoder, Encoder, Profile, Stream } from '@garmin/fitsdk'
const recordMesg = {
timestamp: new Date('2025-05-28T08:38:47.000Z'),
heartRate: 125,
speed: 1.1,
distance: 1.8,
altitude: 20,
}
const encoder = new Encoder()
encoder.onMesg(Profile.MesgNum.RECORD, recordMesg)
const stream = Stream.fromByteArray(encoder.close())
const decoder = new Decoder(stream)
const { messages, errors } = decoder.read()
console.log(messages, errors)
I have tried with applyScaleAndOffset off too, but it doesn't seem to be the issue. This feels like a bug, but I'm not sure.
Does anyone have an idea?