@naturalcycles/js-lib 14.212.0 → 14.213.0

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,6 +1,6 @@
1
1
  import { Iterable2 } from '../iter/iterable2';
2
2
  import type { Inclusiveness, IsoDateString, IsoDateTimeString, MonthId, SortDirection, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
3
- import { LocalTime } from './localTime';
3
+ import { ISODayOfWeek, LocalTime } from './localTime';
4
4
  export type LocalDateUnit = LocalDateUnitStrict | 'week';
5
5
  export type LocalDateUnitStrict = 'year' | 'month' | 'day';
6
6
  export type LocalDateInput = LocalDate | Date | IsoDateString;
@@ -42,6 +42,7 @@ export declare class LocalDate {
42
42
  month(v: number): LocalDate;
43
43
  day(): number;
44
44
  day(v: number): LocalDate;
45
+ dayOfWeek(): ISODayOfWeek;
45
46
  isSame(d: LocalDateInput): boolean;
46
47
  isBefore(d: LocalDateInput, inclusive?: boolean): boolean;
47
48
  isSameOrBefore(d: LocalDateInput): boolean;
@@ -129,6 +129,9 @@ class LocalDate {
129
129
  day(v) {
130
130
  return v === undefined ? this.$day : this.set('day', v);
131
131
  }
132
+ dayOfWeek() {
133
+ return (this.toDate().getDay() || 7);
134
+ }
132
135
  isSame(d) {
133
136
  d = LocalDate.of(d);
134
137
  return this.$day === d.$day && this.$month === d.$month && this.$year === d.$year;
@@ -126,6 +126,9 @@ export class LocalDate {
126
126
  day(v) {
127
127
  return v === undefined ? this.$day : this.set('day', v);
128
128
  }
129
+ dayOfWeek() {
130
+ return (this.toDate().getDay() || 7);
131
+ }
129
132
  isSame(d) {
130
133
  d = LocalDate.of(d);
131
134
  return this.$day === d.$day && this.$month === d.$month && this.$year === d.$year;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.212.0",
3
+ "version": "14.213.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -22,7 +22,7 @@
22
22
  "crypto-js": "^4.1.1",
23
23
  "jest": "^29.0.0",
24
24
  "prettier": "^3.0.0",
25
- "vitepress": "^1.0.0-rc.22",
25
+ "vitepress": "^1.0.0",
26
26
  "vue": "^3.2.45"
27
27
  },
28
28
  "resolutions": {
@@ -9,7 +9,7 @@ import type {
9
9
  UnixTimestampMillisNumber,
10
10
  UnixTimestampNumber,
11
11
  } from '../types'
12
- import { LocalTime } from './localTime'
12
+ import { ISODayOfWeek, LocalTime } from './localTime'
13
13
 
14
14
  export type LocalDateUnit = LocalDateUnitStrict | 'week'
15
15
  export type LocalDateUnitStrict = 'year' | 'month' | 'day'
@@ -177,6 +177,10 @@ export class LocalDate {
177
177
  return v === undefined ? this.$day : this.set('day', v)
178
178
  }
179
179
 
180
+ dayOfWeek(): ISODayOfWeek {
181
+ return (this.toDate().getDay() || 7) as ISODayOfWeek
182
+ }
183
+
180
184
  isSame(d: LocalDateInput): boolean {
181
185
  d = LocalDate.of(d)
182
186
  return this.$day === d.$day && this.$month === d.$month && this.$year === d.$year