Skip to content

Commit

Permalink
in absence of modified date, it'll fetch created.
Browse files Browse the repository at this point in the history
  • Loading branch information
MohanKumarAmbati committed Oct 29, 2024
1 parent dd57305 commit fbbabf1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/npm/npm-last-update.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 })
}
Expand Down

0 comments on commit fbbabf1

Please sign in to comment.