@full-ui/headless-calendar 7.0.0-rc.2 → 7.0.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.
- package/index.d.ts +3 -3
- package/index.js +11 -11
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ interface DateFormattingContext {
|
|
|
128
128
|
locale: Locale;
|
|
129
129
|
calendarSystem: CalendarSystem;
|
|
130
130
|
computeWeekNumber: (d: DateMarker) => number;
|
|
131
|
-
|
|
131
|
+
weekTextLong: string;
|
|
132
132
|
weekTextShort: string;
|
|
133
133
|
cmdFormatter?: CmdDateFormatterFunc;
|
|
134
134
|
}
|
|
@@ -152,7 +152,7 @@ interface DateEnvSettings {
|
|
|
152
152
|
locale: Locale;
|
|
153
153
|
weekNumberCalculation?: WeekNumberCalculation;
|
|
154
154
|
firstDay?: number;
|
|
155
|
-
|
|
155
|
+
weekTextLong?: string;
|
|
156
156
|
weekTextShort?: string;
|
|
157
157
|
cmdFormatter?: CmdDateFormatterFunc;
|
|
158
158
|
}
|
|
@@ -168,7 +168,7 @@ declare class DateEnv {
|
|
|
168
168
|
weekDow: number;
|
|
169
169
|
weekDoy: number;
|
|
170
170
|
weekNumberFunc: any;
|
|
171
|
-
|
|
171
|
+
weekTextLong: string;
|
|
172
172
|
weekTextShort: string;
|
|
173
173
|
cmdFormatter?: CmdDateFormatterFunc;
|
|
174
174
|
constructor(settings: DateEnvSettings);
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as ZonedDateTimeFns from 'temporal-polyfill/fns/
|
|
2
|
-
import * as PlainDateTimeFns from 'temporal-polyfill/fns/
|
|
3
|
-
import * as InstantFns from 'temporal-polyfill/fns/
|
|
1
|
+
import * as ZonedDateTimeFns from 'temporal-polyfill/fns/ZonedDateTime';
|
|
2
|
+
import * as PlainDateTimeFns from 'temporal-polyfill/fns/PlainDateTime';
|
|
3
|
+
import * as InstantFns from 'temporal-polyfill/fns/Instant';
|
|
4
4
|
|
|
5
5
|
// Adding
|
|
6
6
|
function addWeeks(m, n) {
|
|
@@ -576,8 +576,8 @@ class DateEnv {
|
|
|
576
576
|
if (typeof settings.weekNumberCalculation === 'function') {
|
|
577
577
|
this.weekNumberFunc = settings.weekNumberCalculation;
|
|
578
578
|
}
|
|
579
|
-
this.
|
|
580
|
-
this.weekTextShort = settings.weekTextShort ?? settings.
|
|
579
|
+
this.weekTextLong = settings.weekTextLong;
|
|
580
|
+
this.weekTextShort = settings.weekTextShort ?? settings.weekTextLong;
|
|
581
581
|
this.cmdFormatter = settings.cmdFormatter;
|
|
582
582
|
}
|
|
583
583
|
// Creating / Parsing
|
|
@@ -823,9 +823,9 @@ class DateEnv {
|
|
|
823
823
|
if (this.timeZone === 'UTC') {
|
|
824
824
|
return new Date(ms);
|
|
825
825
|
}
|
|
826
|
-
const
|
|
826
|
+
const zdt = InstantFns.toZonedDateTimeISO(InstantFns.fromEpochMilliseconds(ms), this.timeZone);
|
|
827
827
|
return new Date(// a "Date Marker", which is like PlainDateTime
|
|
828
|
-
Date.UTC(
|
|
828
|
+
Date.UTC(zdt.year, zdt.month - 1, zdt.day, zdt.hour, zdt.minute, zdt.second, zdt.millisecond));
|
|
829
829
|
}
|
|
830
830
|
offsetForMarker(m) {
|
|
831
831
|
if (this.timeZone === 'local') {
|
|
@@ -844,7 +844,7 @@ class DateEnv {
|
|
|
844
844
|
if (this.timeZone === 'UTC') {
|
|
845
845
|
return new Date(m.valueOf()); // make sure it's a copy
|
|
846
846
|
}
|
|
847
|
-
return new Date(
|
|
847
|
+
return new Date(PlainDateTimeFns.toZonedDateTime(PlainDateTimeFns.create(m.getUTCFullYear(), m.getUTCMonth() + 1, m.getUTCDate(), m.getUTCHours(), m.getUTCMinutes(), m.getUTCSeconds(), m.getUTCMilliseconds()), this.timeZone).epochMilliseconds);
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
|
|
@@ -907,7 +907,7 @@ class NativeDateFormatter {
|
|
|
907
907
|
}];
|
|
908
908
|
}
|
|
909
909
|
if (this.weekOnly) {
|
|
910
|
-
return formatWeekNumberParts(context.computeWeekNumber(date.marker), context.
|
|
910
|
+
return formatWeekNumberParts(context.computeWeekNumber(date.marker), context.weekTextLong, context.weekTextShort, context.locale, extendedOptions.week);
|
|
911
911
|
}
|
|
912
912
|
const { normalFormat, zeroFormat } = this.getFormats(context);
|
|
913
913
|
const format = (zeroFormat && !date.marker.getUTCMinutes())
|
|
@@ -1054,10 +1054,10 @@ function stripTrailingLiteral(parts) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
-
function formatWeekNumberParts(num,
|
|
1057
|
+
function formatWeekNumberParts(num, weekTextLong, weekTextShort, locale, display) {
|
|
1058
1058
|
const parts = [];
|
|
1059
1059
|
if (display === 'long') {
|
|
1060
|
-
parts.push({ type: 'literal', value:
|
|
1060
|
+
parts.push({ type: 'literal', value: weekTextLong });
|
|
1061
1061
|
}
|
|
1062
1062
|
else if (display === 'short' || display === 'narrow') {
|
|
1063
1063
|
parts.push({ type: 'literal', value: weekTextShort });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@full-ui/headless-calendar",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"headless",
|
|
6
6
|
"calendar",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"title": "Headless Calendar Library",
|
|
10
10
|
"description": "Headless calendar library by the makers of FullCalendar",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"temporal-polyfill": "^0.
|
|
12
|
+
"temporal-polyfill": "^1.0.1"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"homepage": "https://fullcalendar.io",
|