@bbn/bbn 1.0.458 → 1.0.459

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.
package/dist/date.d.ts CHANGED
@@ -43,6 +43,7 @@ declare class bbnDateTool {
43
43
  guessUnit(valueInMs: number): string | null;
44
44
  diff(date: any, unit?: string, abs?: boolean): number;
45
45
  calendar(format: string): string;
46
+ getWeekDay(n: 0 | 1 | 2 | 3 | 4 | 5 | 6, mode?: 'long' | 'short' | 'narrow', locale?: string): String;
46
47
  get daysInMonth(): number;
47
48
  }
48
49
  declare function generatorFunction(value: any, inputFormat?: null | String): bbnDateTool;
package/dist/date.js CHANGED
@@ -495,6 +495,12 @@ class bbnDateTool {
495
495
  }
496
496
  return str;
497
497
  }
498
+ getWeekDay(n, mode = 'long', locale) {
499
+ // Create a date with the right weekday
500
+ // 2023-01-01 was a Sunday → base for offset
501
+ const base = new Date(2023, 0, 1 + n);
502
+ return base.toLocaleDateString([bbn.env.lang, ...navigator.languages], { weekday: mode });
503
+ }
498
504
  get daysInMonth() {
499
505
  if (this.isValid && !__classPrivateFieldGet(this, _bbnDateTool_daysInMonth, "f")) {
500
506
  switch (__classPrivateFieldGet(this, _bbnDateTool_value, "f").getMonth()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.458",
3
+ "version": "1.0.459",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",