@timardex/cluemart-shared 1.5.809 → 1.5.810

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,6 +63,7 @@ __export(utils_exports, {
63
63
  filterVendorEventsBySelectedDate: () => filterVendorEventsBySelectedDate,
64
64
  findEventDateTimeByIsoDate: () => findEventDateTimeByIsoDate,
65
65
  formatDate: () => formatDate,
66
+ formatIrdNumber: () => formatIrdNumber,
66
67
  formatNZBankAccount: () => formatNZBankAccount,
67
68
  formatTimestamp: () => formatTimestamp,
68
69
  fromCalendarIsoDate: () => fromCalendarIsoDate,
@@ -1904,6 +1905,14 @@ function calculateCheckDigit(baseDigits, weights) {
1904
1905
  function normalizeIrdNumber(value) {
1905
1906
  return value.replace(/\D/g, "");
1906
1907
  }
1908
+ function formatIrdNumber(input) {
1909
+ const digitsOnly = normalizeIrdNumber(input).slice(0, 9);
1910
+ const parts = [];
1911
+ if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 3));
1912
+ if (digitsOnly.length > 3) parts.push(digitsOnly.slice(3, 6));
1913
+ if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 9));
1914
+ return parts.join("-");
1915
+ }
1907
1916
  function isValidIrdNumber(value) {
1908
1917
  const digits = normalizeIrdNumber(value);
1909
1918
  if (!/^\d{8,9}$/.test(digits)) {
@@ -1960,6 +1969,7 @@ function isValidIrdNumber(value) {
1960
1969
  filterVendorEventsBySelectedDate,
1961
1970
  findEventDateTimeByIsoDate,
1962
1971
  formatDate,
1972
+ formatIrdNumber,
1963
1973
  formatNZBankAccount,
1964
1974
  formatTimestamp,
1965
1975
  fromCalendarIsoDate,