"use client";
import { addLeadingZeros as n } from "../addLeadingZeros.js";
const u = {
  // Year
  y(t, e) {
    const r = t.getFullYear(), a = r > 0 ? r : 1 - r;
    return n(e === "yy" ? a % 100 : a, e.length);
  },
  // Month
  M(t, e) {
    const r = t.getMonth();
    return e === "M" ? String(r + 1) : n(r + 1, 2);
  },
  // Day of the month
  d(t, e) {
    return n(t.getDate(), e.length);
  },
  // AM or PM
  a(t, e) {
    const r = t.getHours() / 12 >= 1 ? "pm" : "am";
    switch (e) {
      case "a":
      case "aa":
        return r.toUpperCase();
      case "aaa":
        return r;
      case "aaaaa":
        return r[0];
      case "aaaa":
      default:
        return r === "am" ? "a.m." : "p.m.";
    }
  },
  // Hour [1-12]
  h(t, e) {
    return n(t.getHours() % 12 || 12, e.length);
  },
  // Hour [0-23]
  H(t, e) {
    return n(t.getHours(), e.length);
  },
  // Minute
  m(t, e) {
    return n(t.getMinutes(), e.length);
  },
  // Second
  s(t, e) {
    return n(t.getSeconds(), e.length);
  },
  // Fraction of second
  S(t, e) {
    const r = e.length, a = t.getMilliseconds(), s = Math.trunc(
      a * Math.pow(10, r - 3)
    );
    return n(s, e.length);
  }
};
export {
  u as lightFormatters
};
