From e3e59adbeb9b0a795d1e86a5fe3d4580544fb291 Mon Sep 17 00:00:00 2001 From: Sam Noel Date: Fri, 20 Sep 2024 12:30:11 -0400 Subject: [PATCH] remove some moment stuff --- src/Runner.ts | 2 +- src/Service.ts | 5 ++--- src/utils.ts | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Runner.ts b/src/Runner.ts index 7fae87f..060db56 100644 --- a/src/Runner.ts +++ b/src/Runner.ts @@ -143,7 +143,7 @@ export class Runner { contentType: tree.bookmarks.services['*'].jobs.pending['*']._type, data: { status, - time: moment().toISOString(), + time: new Date().toISOString(), meta, }, }); diff --git a/src/Service.ts b/src/Service.ts index c0c8a35..454d9b3 100644 --- a/src/Service.ts +++ b/src/Service.ts @@ -25,7 +25,6 @@ import { debug, error, warn } from './utils.js'; import type { Job } from './Job.js'; import type { Json } from './index.js'; import type { Logger } from './Logger.js'; -import moment from 'moment'; import { Queue } from './Queue.js'; export type Domain = string; @@ -312,7 +311,7 @@ export class Service { } async #initTotalMetrics(): Promise { - const date = moment().format('YYYY-MM-DD'); + const date = new Date().toISOString().split('T')[0]; for await (const status of ['success', 'failure']) { try { let { data } = await this.#oada.get({ @@ -328,7 +327,7 @@ export class Service { async #initTypedMetrics(type: string): Promise { let mtype = type.replaceAll('-', '_').replaceAll(' ', '_'); - const date = moment().format('YYYY-MM-DD'); + const date = new Date().toISOString().split('T')[0]; for await (const status of ['success', 'failure']) { try { this.metrics[`${this.name}_${status}_${mtype}`].set(0); diff --git a/src/utils.ts b/src/utils.ts index e4457e3..b0532cf 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -16,7 +16,6 @@ */ import _debug from 'debug'; -import moment from 'moment'; import type { ConnectionResponse, Json, OADAClient } from '@oada/client'; @@ -101,7 +100,7 @@ export async function postUpdate( contentType: tree.bookmarks.services['*'].jobs.pending['*']._type, data: { status, - time: moment().toISOString(), + time: new Date().toISOString(), meta, }, });