'use strict';

/*!
 * @techmely/utils
 * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
 * MIT Licensed
 */


// src/toISOStringTimezone/index.ts
var pad = (n) => `${Math.floor(Math.abs(n))}`.padStart(2, "0");
var getTimezoneOffset = (date) => {
  const tzOffset = -date.getTimezoneOffset();
  const diff = tzOffset >= 0 ? "+" : "-";
  return `${diff + pad(tzOffset / 60)}:${pad(tzOffset % 60)}`;
};
function toISOStringTimezone(date) {
  return `${date.getFullYear()}
    -${pad(date.getMonth() + 1)}
    -${pad(date.getDate())}
    T${pad(date.getHours())}
    :${pad(date.getMinutes())}
    :${pad(date.getSeconds())}
    ${getTimezoneOffset(date)}`;
}

// src/isISOStringTimeZone/index.ts
function isISOStringWithTimezone(val) {
  const d = new Date(val);
  return !Number.isNaN(d.valueOf()) && toISOStringTimezone(d) === val;
}

exports.isISOStringWithTimezone = isISOStringWithTimezone;
