refactor: add timezone in
This commit is contained in:
parent
4eefe8d9d7
commit
43e6f4ffe0
@ -1,9 +1,12 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import utc from 'dayjs/plugin/utc';
|
import utc from 'dayjs/plugin/utc';
|
||||||
import timezone from 'dayjs/plugin/timezone';
|
import timezone from 'dayjs/plugin/timezone';
|
||||||
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
||||||
import type { DateUnit } from '../../shared';
|
import type { DateUnit } from '../../shared';
|
||||||
|
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
dayjs.extend(timezone);
|
dayjs.extend(timezone);
|
||||||
|
dayjs.extend(advancedFormat);
|
||||||
|
|
||||||
export type { DateUnit };
|
export type { DateUnit };
|
||||||
|
|
||||||
|
@ -165,17 +165,19 @@ class MonitorRunner {
|
|||||||
await this.notify(
|
await this.notify(
|
||||||
`[${monitor.name}] 🔴 Down`,
|
`[${monitor.name}] 🔴 Down`,
|
||||||
`[${monitor.name}] 🔴 Down\nTime: ${dayjs().format(
|
`[${monitor.name}] 🔴 Down\nTime: ${dayjs().format(
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
'YYYY-MM-DD HH:mm:ss (z)'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
currentStatus = 'DOWN';
|
||||||
} else if (value > 0 && currentStatus === 'DOWN') {
|
} else if (value > 0 && currentStatus === 'DOWN') {
|
||||||
await this.createEvent('UP', `Monitor [${monitor.name}] has been up`);
|
await this.createEvent('UP', `Monitor [${monitor.name}] has been up`);
|
||||||
await this.notify(
|
await this.notify(
|
||||||
`[${monitor.name}] ✅ Up`,
|
`[${monitor.name}] ✅ Up`,
|
||||||
`[${monitor.name}] ✅ Up\nTime: ${dayjs().format(
|
`[${monitor.name}] ✅ Up\nTime: ${dayjs().format(
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
'YYYY-MM-DD HH:mm:ss (z)'
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
currentStatus = 'UP';
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert into data
|
// insert into data
|
||||||
|
Loading…
Reference in New Issue
Block a user