Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Removed moment since it's not needed #61

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions netatmo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var util = require('util');
var EventEmitter = require("events").EventEmitter;
var request = require('request');
var moment = require('moment');

const BASE_URL = 'https://api.netatmo.net';

Expand Down Expand Up @@ -341,20 +340,26 @@ netatmo.prototype.getMeasure = function (options, callback) {
}

if (options.date_begin) {
if (options.date_begin <= 1E10) {
options.date_begin *= 1E3;
options.date_begin = parseInt(options.date_begin, 10);

if (options.date_begin >= 1E10) {
options.date_begin /= 1E3;
}

form.date_begin = moment(options.date_begin).utc().unix();
form.date_begin = options.date_begin;
}

if (options.date_end === 'last') {
form.date_end = 'last';
} else if (options.date_end) {
if (options.date_end <= 1E10) {
options.date_end *= 1E3;

options.date_end = parseInt(options.date_end, 10);

if (options.date_end >= 1E10) {
options.date_end /= 1E3;
}
form.date_end = moment(options.date_end).utc().unix();

form.date_end = options.date_end;
}

if (options.limit) {
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
],
"license": "MIT",
"dependencies": {
"moment": "^2.22.2",
"request": "^2.85.0"
}
}