Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sent date with timeSync is last month #33

Open
fits-fujiura-st opened this issue Apr 12, 2021 · 2 comments
Open

sent date with timeSync is last month #33

fits-fujiura-st opened this issue Apr 12, 2021 · 2 comments

Comments

@fits-fujiura-st
Copy link

fits-fujiura-st commented Apr 12, 2021

Node Version: 12.20.0

Node BACstack Version: 0.2.4

  • [ x ] Bug Report

Current Behaviour (Bug Report)

I sent time synchronization with current date, but a day of last month is sent.
Current date is April 13, 2021.

sample code:

const bacnet = require('node-bacnet');
const client = new bacnet();

client.timeSync(MY_DEVICE_IP, new Date());
// MY_DEVICE_IP is actually a valid IP

Expected Behaviour (Bug Report)

I expected timeSynchronization with "Date: April 13, 2021," is sent, but timeSynchronization with "Date: March 13, 2021," is sent

Suspicious code

In JavaScript, the getMonth() method returns the month from 0 to 11.
If library sends it as is, it means last month's data in the BACnet protocol.
So it need call getMonth() + 1 to create buffer in encodeBacnetDate.

code to be fixed:

buffer.buffer[buffer.offset++] = value.getMonth();

@Apollon77
Copy link
Collaborator

@fits-fujiura could you provide this as a PR?

@fits-fujiura-st
Copy link
Author

@Apollon77

@fits-fujiura could you provide this as a PR?

Yes, I can.
First, I will check CONTRIBUTING.md.

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

No branches or pull requests

2 participants