Files
klz-cables.com/.pnpm-store/v10/files/82/295cbb3fdf0bce8cecad9e25d85034ca6ccd1c54af3b2956b3eb28ddaf30173c8dbaa3cad2998f838040baede42eec772b22061196b268c7c311a0c4242689
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

27 lines
651 B
Plaintext

'use strict'
module.exports = createDate
const isValidDate = require('./is-valid-date')
/**
* Constructs a JS Date from a number or string. Accepts any single number
* or single string argument that is valid for the Date() constructor,
* or an epoch as a string.
*
* @param {string|number} epoch The representation of the Date.
*
* @returns {Date} The constructed Date.
*/
function createDate (epoch) {
// If epoch is already a valid argument, return the valid Date
let date = new Date(epoch)
if (isValidDate(date)) {
return date
}
// Convert to a number to permit epoch as a string
date = new Date(+epoch)
return date
}