Skip to content

Conversation

@cdriks
Copy link

@cdriks cdriks commented Nov 3, 2022

Hi,

by performing a readProperty to property 130 (event-time-stamps), the returned value is seen as "Invalid Date".

Steps to reproduce Issue (Bug Report)

const bacstack = require('bacstack');

const client = new bacstack()

client.readProperty('10.12.44.11', { type: 2, instance: 8194 }, 130, (err, value) => {
    console.log(err)
    console.log(JSON.stringify(value.values))
    console.log(value.values)
})

returns :

[
  { type: 104, value: Invalid Date },
  { type: 104, value: Invalid Date },
  { type: 104, value: Invalid Date }
]

The cause from this can be found at asn1.js, line 1000.

The date variable has the following value : {"len":5,"value":{"len":4,"value":"2022-10-26T22:00:00.000Z"}}, and the time : {"len":5,"value":{"len":4,"value":"1901-02-01T15:26:22.600Z"}}

What does this Pull Request do

After the correction, the result of the above-mentioned command is :

[
  { type: 104, value: 2022-09-27T14:26:22.600Z },
  { type: 104, value: 1900-12-31T23:00:00.000Z },
  { type: 104, value: 2022-09-27T15:34:59.800Z }
]

There, the second item of the array is not completely correct (it should be unspecified), but it makes the job...

Thanks in advance,

Cédric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant