diff --git a/src/client/utils/date.ts b/src/client/utils/date.ts index 7340544..66a5e97 100644 --- a/src/client/utils/date.ts +++ b/src/client/utils/date.ts @@ -1,9 +1,12 @@ import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import timezone from 'dayjs/plugin/timezone'; +import advancedFormat from 'dayjs/plugin/advancedFormat'; import type { DateUnit } from '../../shared'; + dayjs.extend(utc); dayjs.extend(timezone); +dayjs.extend(advancedFormat); export type { DateUnit }; diff --git a/src/server/model/monitor/index.ts b/src/server/model/monitor/index.ts index fccd347..1151186 100644 --- a/src/server/model/monitor/index.ts +++ b/src/server/model/monitor/index.ts @@ -165,17 +165,19 @@ class MonitorRunner { await this.notify( `[${monitor.name}] 🔴 Down`, `[${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') { await this.createEvent('UP', `Monitor [${monitor.name}] has been up`); await this.notify( `[${monitor.name}] ✅ Up`, `[${monitor.name}] ✅ Up\nTime: ${dayjs().format( - 'YYYY-MM-DD HH:mm:ss' + 'YYYY-MM-DD HH:mm:ss (z)' )}` ); + currentStatus = 'UP'; } // insert into data