function durationToNumber(value) {
    // We accept the full specification
    // eslint-disable-next-line regexp/no-super-linear-backtracking
    const regex = /^P((?<y>\d+)Y)?((?<m>\d+)M)?((?<d>\d+)D)?(T((?<th>\d+)H)?((?<tm>\d+)M)?((?<ts>\d+(.\d+)?)S)?)?$/;
    const match = regex.exec(value);
    let result = 0;
    result += parseInt(match.groups["y"] || "0") * 60 * 60 * 24 * 30 * 12;
    result += parseInt(match.groups["m"] || "0") * 60 * 60 * 24 * 30;
    result += parseInt(match.groups["d"] || "0") * 60 * 60 * 24;
    result += parseInt(match.groups["th"] || "0") * 60 * 60;
    result += parseInt(match.groups["tm"] || "0") * 60;
    result += parseFloat(match.groups["ts"] || "0");
    return result;
}
Convert ISO8601 duration to number of seconds

@param {string} value
@return {number}