Skip to content

Commit

Permalink
Merge pull request #3 from tago-io/dayjs
Browse files Browse the repository at this point in the history
moment replaced by dayjs - INT-1
  • Loading branch information
felipefdl authored Dec 14, 2020
2 parents 967a093 + fddda65 commit 4fe271b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

const { Analysis, Account, Services, Utils } = require("@tago-io/sdk");
const moment = require("moment-timezone");
const dayjs = require("dayjs");

async function myAnalysis(context) {
// Transform all Environment Variable to JSON.
Expand Down Expand Up @@ -63,10 +63,10 @@ async function myAnalysis(context) {

context.log("Checking devices: ", devices.map((x) => x.name).join(", "));

const now = moment();
const now = dayjs();
const alert_devices = [];
for (const device of devices) {
const last_input = moment(new Date(device.last_input));
const last_input = dayjs(new Date(device.last_input));

// Check the difference in minutes.
const diff = now.diff(last_input, "minute");
Expand Down

0 comments on commit 4fe271b

Please sign in to comment.