From fbbabf1be8196bef59949f73eb6e6b20234e89af Mon Sep 17 00:00:00 2001 From: MohanKumarAmbati Date: Tue, 29 Oct 2024 16:05:00 +0530 Subject: [PATCH] in absence of modified date, it'll fetch created. --- services/npm/npm-last-update.service.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/npm/npm-last-update.service.js b/services/npm/npm-last-update.service.js index 857051fcd9535..68f220062e575 100644 --- a/services/npm/npm-last-update.service.js +++ b/services/npm/npm-last-update.service.js @@ -7,6 +7,7 @@ import NpmBase, { packageNameDescription } from './npm-base.js' const updateResponseSchema = Joi.object({ time: Joi.object({ + created: Joi.string().required(), modified: Joi.string().required(), }) .pattern(Joi.string(), Joi.any()) @@ -63,7 +64,7 @@ export class NpmLastUpdate extends NpmBase { schema: updateResponseSchema, }) - const date = dayjs(time.modified) + const date = time.modified ? dayjs(time.modified) : dayjs(time.created) return this.constructor.render({ date }) }