Files
klz-cables.com/.pnpm-store/v10/files/9c/7b2aa7be0c8299e2d136ad7dc15ea9af8201bd5ede0bb86ef3564d8dc87fa750b9374e672a5b67e1c6400ba4d7a4543fbfe439aefe7d66aba85d85401da7a3
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

40 lines
959 B
Plaintext

"use strict";
exports.formatISODuration = formatISODuration;
/**
* @name formatISODuration
* @category Common Helpers
* @summary Format a duration object according as ISO 8601 duration string
*
* @description
* Format a duration object according to the ISO 8601 duration standard (https://www.digi.com/resources/documentation/digidocs//90001488-13/reference/r_iso_8601_duration_format.htm)
*
* @param duration - The duration to format
*
* @returns The ISO 8601 duration string
*
* @example
* // Format the given duration as ISO 8601 string
* const result = formatISODuration({
* years: 39,
* months: 2,
* days: 20,
* hours: 7,
* minutes: 5,
* seconds: 0
* })
* //=> 'P39Y2M20DT0H0M0S'
*/
function formatISODuration(duration) {
const {
years = 0,
months = 0,
days = 0,
hours = 0,
minutes = 0,
seconds = 0,
} = duration;
return `P${years}Y${months}M${days}DT${hours}H${minutes}M${seconds}S`;
}