@aotearoan/neon 16.0.3 → 16.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"gFAGO,MAAMA,CAAc,CAOzB,OAAc,iBAAiBC,EAAcC,EAAiBC,EAAS,GAAiB,CAChF,MAAAC,EAAMF,GAAU,UAAU,SAC1BG,MAAU,KACVC,EAAU,IAAI,KAAK,CAACH,GAAUF,EAAK,SAAW,GAAK,GAAGA,CAAI,IAAII,EAAI,cAAc,MAAM,GAAG,EAAE,CAAC,CAAC,GAAKJ,CAAI,EACxG,IAAAM,EACAN,EAAK,OAAS,KAChBM,EAAOD,EAAQ,eACbF,EACAH,EAAK,QAAU,GACX,CAAE,OAAQ,GAAO,KAAM,UAAW,OAAQ,SAC1C,EAAA,CAAE,OAAQ,GAAO,KAAM,UAAW,OAAQ,UAAW,OAAQ,SAAU,CAAA,GAI/E,MAAMO,EAAmB,CACvB,KAAM,CAACF,EAAQ,eAAe,QAAS,CAAE,KAAM,UAAW,EAC1D,cAAeA,EAAQ,eAAeF,EAAK,CAAE,KAAM,UAAW,EAC9D,MAAO,CAACE,EAAQ,eAAe,QAAS,CAAE,MAAO,UAAW,EAC5D,eAAgBA,EAAQ,eAAeF,EAAK,CAAE,MAAO,QAAS,EAC9D,cAAeE,EAAQ,eAAeF,EAAK,CAAE,MAAO,OAAQ,EAC5D,IAAK,CAACE,EAAQ,eA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AoBC,EAAkB,IAAI,KAAKA,EAAiBD,EAAmB,EAAG,EAAE,EAAI,KACvGO,GAAgBD,GAAA,YAAAA,EAAU,eAAenB,EAAK,CAAE,MAAO,MAAQ,KAAKgB,EAAM,cAC1EK,EAAWP,GAAmBE,EAAM,KACpCM,EAAkBP,GAA0B,KAAK,MAAMM,EAAW,EAAE,EAAI,GAGxExB,EAAO,IAAI,KAAKwB,GAAWH,EAAY,IAAM,GAAI,CAAC,EAClDK,EAAa,IAAI,KAAKF,GAAWH,EAAY,IAAM,GAAI,CAAC,EAC9DK,EAAW,QAAQA,EAAW,QAAQ,EAAI,CAAC,EAE3C,MAAMC,EAAqC,CAAA,EAE3C,IAAIC,EAAiB,EACjBC,EAAO,GAEX,QAASC,EAAM,EAAGA,EAAM,EAAGA,IAAO,CAC1BH,EAAAG,CAAG,EAAI,GAEb,QAASC,EAAM,EAAGA,EAAM,EAAGA,IACzB,GAAID,IAAQ,GAAKC,EAAML,EAAW,SAC1BC,EAAAG,CAAG,EAAEC,CAAG,EAAI,aAElBJ,EAAMG,CAAG,EAAEC,CAAG,EAAI/B,EAAK,QAAQ,EAC/B4B,EAAiB5B,EAAK,UACtBA,EAAK,QAAQA,EAAK,QAAQ,EAAI,CAAC,EAE3BA,EAAK,QAAQ,IAAM,EAAG,CACxB,QAASgC,EAAID,EAAM,EAAGC,EAAI,EAAGA,IACrBL,EAAAG,CAAG,EAAEE,CAAC,EAAI,KAEXH,EAAA,GACP,KACF,CAIJ,GAAIA,EACF,KAEJ,CAEO,MAAA,CACL,MAAAV,EACA,SAAAC,EACA,UAAAC,EACA,cAAAE,EACA,SAAAC,EACA,gBAAAC,EACA,SAAU1B,EAAc,SAASI,CAAG,EACpC,MAAAwB,EACA,eAAAC,EACA,OAAQ7B,EAAc,WAAWI,CAAG,CAAA,CAExC,CACF"}
1
+ {"version":3,"file":"NeonDateUtils.cjs.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns a NeonDate object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object\n * @param time {boolean} Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date string, optionally with the time as well\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date string for the given parameters\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"gFAGO,MAAMA,CAAc,CAUzB,OAAc,iBAAiBC,EAAcC,EAAiBC,EAAS,GAAiB,CAChF,MAAAC,EAAMF,GAAU,UAAU,SAC1BG,MAAU,KACVC,EAAU,IAAI,KAAK,CAACH,GAAUF,EAAK,SAAW,GAAK,GAAGA,CAAI,IAAII,EAAI,cAAc,MAAM,GAAG,EAAE,CAAC,CAAC,GAAKJ,CAAI,EACxG,IAAAM,EACAN,EAAK,OAAS,KAChBM,EAAOD,EAAQ,eACbF,EACAH,EAAK,QAAU,GACX,CAAE,OAAQ,GAAO,KAAM,UAAW,OAAQ,SAC1C,EAAA,CAAE,OAAQ,GAAO,KAAM,UAAW,OAAQ,UAAW,OAAQ,SAAU,CAAA,GAI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CAIJ,GAAIA,EACF,KAEJ,CAEO,MAAA,CACL,MAAAV,EACA,SAAAC,EACA,UAAAC,EACA,cAAAE,EACA,SAAAC,EACA,gBAAAC,EACA,SAAU1B,EAAc,SAASI,CAAG,EACpC,MAAAwB,EACA,eAAAC,EACA,OAAQ7B,EAAc,WAAWI,CAAG,CAAA,CAExC,CACF"}
@@ -1,9 +1,12 @@
1
1
  class c {
2
2
  /**
3
3
  * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.
4
+ *
4
5
  * @param date The date/time as an <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> string.
5
6
  * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
6
7
  * @param strict Do not add time component to localise the date.
8
+ *
9
+ * @returns a NeonDate object representing the provided date.
7
10
  */
8
11
  static stringToNeonDate(t, o, e = !1) {
9
12
  const a = o || navigator.language, i = /* @__PURE__ */ new Date(), n = new Date(!e && t.length === 10 ? `${t}T${i.toISOString().split("T")[1]}` : t);
@@ -23,13 +26,37 @@ class c {
23
26
  };
24
27
  return r && (d.time = r), d;
25
28
  }
29
+ /**
30
+ * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.
31
+ *
32
+ * @param date Javascript date object
33
+ * @param time {boolean} Whether to consider the time as part of the conversion to the ISO string.
34
+ *
35
+ * @returns an ISO 8601 formatted date string, optionally with the time as well
36
+ */
26
37
  static dateToIso(t, o = !1) {
27
38
  const e = t.toISOString();
28
39
  return o ? e : e.split("T")[0];
29
40
  }
41
+ /**
42
+ * Convert the params received into an ISO 8601 formatted string with only date in it.
43
+ *
44
+ * @param day The number of the day to be used.
45
+ * @param month The number of the month to be used.
46
+ * @param year The number of the year to be used.
47
+ *
48
+ * @returns an ISO 8601 formatted date string for the given parameters
49
+ */
30
50
  static dmyToIso(t, o, e) {
31
51
  return `${e}-${o < 10 ? "0" + o : o}-${t < 10 ? "0" + t : t}`;
32
52
  }
53
+ /**
54
+ * Returns the days of the week starting at Monday day name translated using the locale received as a first element.
55
+ *
56
+ * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
57
+ *
58
+ * @returns an array with the days of the week named according to the locale received.
59
+ */
33
60
  static dowNames(t) {
34
61
  const o = t || navigator.language, e = /* @__PURE__ */ new Date(), a = [];
35
62
  for (; !a[e.getDay()]; )
@@ -37,6 +64,12 @@ class c {
37
64
  const i = a.shift();
38
65
  return i && a.push(i), a;
39
66
  }
67
+ /**
68
+ * Returns the months of the year starting at January month name translated using the locale received as a first element.
69
+ *
70
+ * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
71
+ * @returns an array with the month names of the year, all named according to the locale received.
72
+ */
40
73
  static monthNames(t) {
41
74
  const o = t || navigator.language;
42
75
  return Array.from(Array(12).keys()).map((e) => new Date(2023, e, 15).toLocaleString(o, { month: "short" }));
@@ -1 +1 @@
1
- {"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"AAGO,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOzB,OAAc,iBAAiBC,GAAcC,GAAiBC,IAAS,IAAiB;AAChF,UAAAC,IAAMF,KAAU,UAAU,UAC1BG,wBAAU,QACVC,IAAU,IAAI,KAAK,CAACH,KAAUF,EAAK,WAAW,KAAK,GAAGA,CAAI,IAAII,EAAI,cAAc,MAAM,GAAG,EAAE,CAAC,CAAC,KAAKJ,CAAI;AACxG,QAAAM;AACA,IAAAN,EAAK,SAAS,OAChBM,IAAOD,EAAQ;AAAA,MACbF;AA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AAAG,CAAG,EAAEC,CAAG,IAAI;AAAA,iBAElBJ,EAAMG,CAAG,EAAEC,CAAG,IAAI/B,EAAK,QAAQ,GAC/B4B,IAAiB5B,EAAK,WACtBA,EAAK,QAAQA,EAAK,QAAQ,IAAI,CAAC,GAE3BA,EAAK,QAAQ,MAAM,GAAG;AACxB,mBAASgC,IAAID,IAAM,GAAGC,IAAI,GAAGA;AACrB,YAAAL,EAAAG,CAAG,EAAEE,CAAC,IAAI;AAEX,UAAAH,IAAA;AACP;AAAA,QACF;AAIJ,UAAIA;AACF;AAAA,IAEJ;AAEO,WAAA;AAAA,MACL,OAAAV;AAAA,MACA,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,eAAAE;AAAA,MACA,UAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,UAAU1B,EAAc,SAASI,CAAG;AAAA,MACpC,OAAAwB;AAAA,MACA,gBAAAC;AAAA,MACA,QAAQ7B,EAAc,WAAWI,CAAG;AAAA,IAAA;AAAA,EAExC;AACF;"}
1
+ {"version":3,"file":"NeonDateUtils.es.js","sources":["../../../src/common/utils/NeonDateUtils.ts"],"sourcesContent":["import type { NeonCalendarConfig } from '@/common/models/NeonCalendarConfig';\nimport type { NeonDate } from '@/common/models/NeonDate';\n\nexport class NeonDateUtils {\n /**\n * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.\n *\n * @param date The date/time as an <a href=\"https://en.wikipedia.org/wiki/ISO_8601\">ISO 8601</a> string.\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @param strict Do not add time component to localise the date.\n *\n * @returns a NeonDate object representing the provided date.\n */\n public static stringToNeonDate(date: string, locale?: string, strict = false): NeonDate {\n const loc = locale || navigator.language;\n const now = new Date();\n const dateObj = new Date(!strict && date.length === 10 ? `${date}T${now.toISOString().split('T')[1]}` : date);\n let time;\n if (date.length > 10) {\n time = dateObj.toLocaleString(\n loc,\n date.length <= 16\n ? { hour12: false, hour: '2-digit', minute: '2-digit' }\n : { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' },\n );\n }\n\n const result: NeonDate = {\n year: +dateObj.toLocaleString('en-US', { year: 'numeric' }),\n yearFormatted: dateObj.toLocaleString(loc, { year: 'numeric' }),\n month: +dateObj.toLocaleString('en-US', { month: 'numeric' }),\n monthShortName: dateObj.toLocaleString(loc, { month: 'short' }),\n monthLongName: dateObj.toLocaleString(loc, { month: 'long' }),\n day: +dateObj.toLocaleString('en-US', { day: 'numeric' }),\n dayFormatted: dateObj.toLocaleString(loc, { day: '2-digit' }),\n };\n\n if (time) {\n result.time = time;\n }\n\n return result;\n }\n\n /**\n * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.\n *\n * @param date Javascript date object\n * @param time {boolean} Whether to consider the time as part of the conversion to the ISO string.\n *\n * @returns an ISO 8601 formatted date string, optionally with the time as well\n */\n public static dateToIso(date: Date, time = false): string {\n const dateString = date.toISOString();\n return time ? dateString : dateString.split('T')[0];\n }\n\n /**\n * Convert the params received into an ISO 8601 formatted string with only date in it.\n *\n * @param day The number of the day to be used.\n * @param month The number of the month to be used.\n * @param year The number of the year to be used.\n *\n * @returns an ISO 8601 formatted date string for the given parameters\n */\n public static dmyToIso(day: number, month: number, year: number): string {\n return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;\n }\n\n /**\n * Returns the days of the week starting at Monday day name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n *\n * @returns an array with the days of the week named according to the locale received.\n */\n public static dowNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n const date = new Date();\n\n const weekdays = [];\n while (!weekdays[date.getDay()]) {\n weekdays[date.getDay()] = date.toLocaleString(loc, { weekday: 'short' });\n date.setDate(date.getDate() + 1);\n }\n\n const sunday = weekdays.shift();\n if (sunday) {\n weekdays.push(sunday);\n }\n\n return weekdays;\n }\n\n /**\n * Returns the months of the year starting at January month name translated using the locale received as a first element.\n *\n * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.\n * @returns an array with the month names of the year, all named according to the locale received.\n */\n public static monthNames(locale?: string): Array<string> {\n const loc = locale || navigator.language;\n\n return Array.from(Array(12).keys()).map((key) => {\n const date = new Date(2023, key, 15);\n return date.toLocaleString(loc, { month: 'short' });\n });\n }\n\n public static toCalendarConfiguration(\n selectedDate?: string,\n currentPageMonth?: number,\n currentPageYear?: number,\n currentPageDecadeStart?: number,\n locale?: string,\n ): NeonCalendarConfig {\n const loc = locale || navigator.language;\n const today = NeonDateUtils.stringToNeonDate(NeonDateUtils.dateToIso(new Date()), loc);\n const selected = selectedDate ? NeonDateUtils.stringToNeonDate(selectedDate, loc, true) : undefined;\n // month indexed from 1-12\n const pageMonth = currentPageMonth || today.month;\n\n // month indexed from 0-11\n const pageDate = currentPageMonth && currentPageYear ? new Date(currentPageYear, currentPageMonth - 1, 15) : null;\n const pageMonthName = pageDate?.toLocaleString(loc, { month: 'long' }) || today.monthLongName;\n const pageYear = currentPageYear || today.year;\n const pageDecadeStart = currentPageDecadeStart || Math.floor(pageYear / 10) * 10;\n\n // determine dow of first day of month. Months are indexed from 0 here\n const date = new Date(pageYear, (pageMonth + 11) % 12, 1);\n const offsetDate = new Date(pageYear, (pageMonth + 11) % 12, 1);\n offsetDate.setDate(offsetDate.getDate() - 1);\n\n const dates: Array<Array<number | null>> = [];\n\n let lastDayOfMonth = 1;\n let done = false;\n\n for (let row = 0; row < 6; row++) {\n dates[row] = [];\n\n for (let col = 0; col < 7; col++) {\n if (row === 0 && col < offsetDate.getDay()) {\n dates[row][col] = null;\n } else {\n dates[row][col] = date.getDate();\n lastDayOfMonth = date.getDate();\n date.setDate(date.getDate() + 1);\n\n if (date.getDate() === 1) {\n for (let i = col + 1; i < 7; i++) {\n dates[row][i] = null;\n }\n done = true;\n break;\n }\n }\n }\n\n if (done) {\n break;\n }\n }\n\n return {\n today,\n selected,\n pageMonth,\n pageMonthName,\n pageYear,\n pageDecadeStart,\n dowNames: NeonDateUtils.dowNames(loc),\n dates,\n lastDayOfMonth,\n months: NeonDateUtils.monthNames(loc),\n };\n }\n}\n"],"names":["NeonDateUtils","date","locale","strict","loc","now","dateObj","time","result","dateString","day","month","year","weekdays","sunday","key","selectedDate","currentPageMonth","currentPageYear","currentPageDecadeStart","today","selected","pageMonth","pageDate","pageMonthName","pageYear","pageDecadeStart","offsetDate","dates","lastDayOfMonth","done","row","col","i"],"mappings":"AAGO,MAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUzB,OAAc,iBAAiBC,GAAcC,GAAiBC,IAAS,IAAiB;AAChF,UAAAC,IAAMF,KAAU,UAAU,UAC1BG,wBAAU,QACVC,IAAU,IAAI,KAAK,CAACH,KAAUF,EAAK,WAAW,KAAK,GAAGA,CAAI,IAAII,EAAI,cAAc,MAAM,GAAG,EAAE,CAAC,CAAC,KAAKJ,CAAI;AACxG,QAAAM;AACA,IAAAN,EAAK,SAAS,OAChBM,IAAOD,EAAQ;AAAA,MACbF;AAAA,MACAH,EAAK,UAAU,KACX,EAAE,QAAQ,IAAO,MAAM,WAAW,QAAQ,UAC1C,IAAA,EAAE,QAAQ,IAAO,MAAM,WAAW,QAAQ,WAAW,QAAQ,UAAU;AAAA,IAAA;AAI/E,UAAMO,IAAmB;AAAA,MACvB,MAAM,CAACF,EAAQ,eAAe,SAAS,EAAE,MAAM,WAAW;AAAA,MAC1D,eAAeA,EAAQ,eAAeF,GAAK,EAAE,MAAM,WAAW;AAAA,MAC9D,OAAO,CAACE,EAAQ,eAAe,SAAS,EAAE,OAAO,WAAW;AAAA,MAC5D,gBAAgBA,EAAQ,eAAeF,GAAK,EAAE,OAAO,SAAS;AAAA,MAC9D,eAAeE,EAAQ,eAAeF,GAAK,EAAE,OAAO,QAAQ;AAAA,MAC5D,KAAK,CAACE,EAAQ,eAAe,SAAS,EAAE,KAAK,WAAW;AAAA,MACxD,cAAcA,EAAQ,eAAeF,GAAK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MACA,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,eAAAE;AAAA,MACA,UAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,UAAU1B,EAAc,SAASI,CAAG;AAAA,MACpC,OAAAwB;AAAA,MACA,gBAAAC;AAAA,MACA,QAAQ7B,EAAc,WAAWI,CAAG;AAAA,IAAA;AAAA,EAExC;AACF;"}
@@ -3,14 +3,47 @@ import type { NeonDate } from '@/common/models/NeonDate';
3
3
  export declare class NeonDateUtils {
4
4
  /**
5
5
  * Convert an ISO 8601 formatted string to a locale formatted date with a three letter month, a 2 digit day and a locale formatted time.
6
+ *
6
7
  * @param date The date/time as an <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> string.
7
8
  * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
8
9
  * @param strict Do not add time component to localise the date.
10
+ *
11
+ * @returns a NeonDate object representing the provided date.
9
12
  */
10
13
  static stringToNeonDate(date: string, locale?: string, strict?: boolean): NeonDate;
14
+ /**
15
+ * Convert a date object to an ISO 8601 formatted string. By default, the time is not considered.
16
+ *
17
+ * @param date Javascript date object
18
+ * @param time {boolean} Whether to consider the time as part of the conversion to the ISO string.
19
+ *
20
+ * @returns an ISO 8601 formatted date string, optionally with the time as well
21
+ */
11
22
  static dateToIso(date: Date, time?: boolean): string;
23
+ /**
24
+ * Convert the params received into an ISO 8601 formatted string with only date in it.
25
+ *
26
+ * @param day The number of the day to be used.
27
+ * @param month The number of the month to be used.
28
+ * @param year The number of the year to be used.
29
+ *
30
+ * @returns an ISO 8601 formatted date string for the given parameters
31
+ */
12
32
  static dmyToIso(day: number, month: number, year: number): string;
33
+ /**
34
+ * Returns the days of the week starting at Monday day name translated using the locale received as a first element.
35
+ *
36
+ * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
37
+ *
38
+ * @returns an array with the days of the week named according to the locale received.
39
+ */
13
40
  static dowNames(locale?: string): Array<string>;
41
+ /**
42
+ * Returns the months of the year starting at January month name translated using the locale received as a first element.
43
+ *
44
+ * @param locale The locale for which to convert the date for display purposes, defaults to browser locale.
45
+ * @returns an array with the month names of the year, all named according to the locale received.
46
+ */
14
47
  static monthNames(locale?: string): Array<string>;
15
48
  static toCalendarConfiguration(selectedDate?: string, currentPageMonth?: number, currentPageYear?: number, currentPageDecadeStart?: number, locale?: string): NeonCalendarConfig;
16
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aotearoan/neon",
3
3
  "description": "Neon is a lightweight design library of Vue 3 components with minimal dependencies.",
4
- "version": "16.0.3",
4
+ "version": "16.0.4",
5
5
  "main": "./dist/neon.cjs.js",
6
6
  "module": "./dist/neon.es.js",
7
7
  "types": "./dist/src/neon.d.ts",
@@ -18,7 +18,7 @@
18
18
  "dev": "node doc-gen.js && npm run gen:version && vite",
19
19
  "build": "npm run gen:version && vite build && vue-tsc --emitDeclarationOnly",
20
20
  "build:app": "npm run gen:version && vite --config vite.config.app.ts build",
21
- "test": "npm run gen:version && cross-env TZ=UTC jest --no-cache --maxWorkers=2",
21
+ "test": "npm run gen:version && jest --no-cache --maxWorkers=2",
22
22
  "preview": "npm run build:app && vite preview --port 4173",
23
23
  "build-only": "vite build",
24
24
  "type-check": "vue-tsc --noEmit",
@@ -87,7 +87,6 @@
87
87
  "@vue/test-utils": "^2.3.2",
88
88
  "@vue/tsconfig": "^0.4.0",
89
89
  "@vue/vue3-jest": "^29.2.4",
90
- "cross-env": "^7.0.3",
91
90
  "eslint": "^8.40.0",
92
91
  "eslint-config-prettier": "^8.8.0",
93
92
  "eslint-import-resolver-typescript": "^3.5.5",
@@ -51,7 +51,8 @@
51
51
  & > .neon-card-header,
52
52
  & > .neon-card-body,
53
53
  & > .neon-card-footer {
54
- @include layout.padding(0.5);
54
+ @include layout.padding-horizontal(0.5, 0.5);
55
+ @include layout.padding-vertical(0.25, 0.25);
55
56
  }
56
57
  }
57
58
 
@@ -54,9 +54,15 @@
54
54
  .neon-tree-menu__section-link {
55
55
  font-size: var(--neon-font-size-l);
56
56
  font-weight: var(--neon-font-weight-bold);
57
+
58
+ &:visited {
59
+ color: var(--neon-color-text);
60
+ }
57
61
  }
58
62
 
59
63
  .neon-tree-menu__section {
64
+ color: var(--neon-color-text);
65
+
60
66
  & > .neon-tree-menu__link {
61
67
  font-size: var(--neon-font-size-m);
62
68
  }