@forcecalendar/interface 1.0.49 → 1.0.51
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/force-calendar-interface.esm.js +246 -239
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +35 -35
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +0 -1
- package/src/renderers/DayViewRenderer.js +4 -3
- package/src/renderers/MonthViewRenderer.js +3 -2
- package/src/renderers/WeekViewRenderer.js +3 -2
- package/src/utils/DateUtils.js +8 -0
package/package.json
CHANGED
|
@@ -34,7 +34,6 @@ export class ForceCalendar extends BaseComponent {
|
|
|
34
34
|
this.stateManager = null;
|
|
35
35
|
this.currentView = null;
|
|
36
36
|
this._hasRendered = false; // Track if initial render is complete
|
|
37
|
-
this._cachedStyles = null; // Cache styles to avoid recreation
|
|
38
37
|
this._busUnsubscribers = [];
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { BaseViewRenderer } from './BaseViewRenderer.js';
|
|
8
|
+
import { DateUtils } from '../utils/DateUtils.js';
|
|
8
9
|
|
|
9
10
|
export class DayViewRenderer extends BaseViewRenderer {
|
|
10
11
|
constructor(container, stateManager) {
|
|
@@ -54,12 +55,12 @@ export class DayViewRenderer extends BaseViewRenderer {
|
|
|
54
55
|
|
|
55
56
|
_extractDayData(viewData, currentDate) {
|
|
56
57
|
let dayDate, dayName, isToday, allDayEvents, timedEvents;
|
|
57
|
-
const
|
|
58
|
+
const locale = this.stateManager.getState().config.locale || 'en-US';
|
|
58
59
|
|
|
59
60
|
if (viewData.type === 'day' && viewData.date) {
|
|
60
61
|
// Core day view structure
|
|
61
62
|
dayDate = new Date(viewData.date);
|
|
62
|
-
dayName = viewData.dayName ||
|
|
63
|
+
dayName = viewData.dayName || DateUtils.getDayName(dayDate.getDay(), locale);
|
|
63
64
|
isToday = viewData.isToday !== undefined ? viewData.isToday : this.isToday(dayDate);
|
|
64
65
|
allDayEvents = viewData.allDayEvents || [];
|
|
65
66
|
|
|
@@ -82,7 +83,7 @@ export class DayViewRenderer extends BaseViewRenderer {
|
|
|
82
83
|
const dayDataItem =
|
|
83
84
|
viewData.days.find(d => this.isSameDay(new Date(d.date), currentDate)) || viewData.days[0];
|
|
84
85
|
dayDate = new Date(dayDataItem.date);
|
|
85
|
-
dayName =
|
|
86
|
+
dayName = DateUtils.getDayName(dayDate.getDay(), locale);
|
|
86
87
|
isToday = this.isToday(dayDate);
|
|
87
88
|
const events = dayDataItem.events || [];
|
|
88
89
|
allDayEvents = events.filter(e => e.allDay);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { BaseViewRenderer } from './BaseViewRenderer.js';
|
|
8
|
+
import { DateUtils } from '../utils/DateUtils.js';
|
|
8
9
|
|
|
9
10
|
export class MonthViewRenderer extends BaseViewRenderer {
|
|
10
11
|
constructor(container, stateManager) {
|
|
@@ -50,11 +51,11 @@ export class MonthViewRenderer extends BaseViewRenderer {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
_getDayNames(weekStartsOn) {
|
|
53
|
-
const
|
|
54
|
+
const locale = this.stateManager.getState().config.locale || 'en-US';
|
|
54
55
|
const dayNames = [];
|
|
55
56
|
for (let i = 0; i < 7; i++) {
|
|
56
57
|
const dayIndex = (weekStartsOn + i) % 7;
|
|
57
|
-
dayNames.push(
|
|
58
|
+
dayNames.push(DateUtils.getDayAbbreviation(dayIndex, locale));
|
|
58
59
|
}
|
|
59
60
|
return dayNames;
|
|
60
61
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { BaseViewRenderer } from './BaseViewRenderer.js';
|
|
8
|
+
import { DateUtils } from '../utils/DateUtils.js';
|
|
8
9
|
|
|
9
10
|
export class WeekViewRenderer extends BaseViewRenderer {
|
|
10
11
|
constructor(container, stateManager) {
|
|
@@ -34,7 +35,7 @@ export class WeekViewRenderer extends BaseViewRenderer {
|
|
|
34
35
|
|
|
35
36
|
_renderWeekView(viewData, _config) {
|
|
36
37
|
const days = viewData.days;
|
|
37
|
-
const
|
|
38
|
+
const locale = this.stateManager.getState().config.locale || 'en-US';
|
|
38
39
|
const hours = Array.from({ length: 24 }, (_, i) => i);
|
|
39
40
|
|
|
40
41
|
// Process days to categorize events
|
|
@@ -44,7 +45,7 @@ export class WeekViewRenderer extends BaseViewRenderer {
|
|
|
44
45
|
return {
|
|
45
46
|
...day,
|
|
46
47
|
date: dayDate,
|
|
47
|
-
dayName:
|
|
48
|
+
dayName: DateUtils.getDayAbbreviation(dayDate.getDay(), locale),
|
|
48
49
|
dayOfMonth: dayDate.getDate(),
|
|
49
50
|
isToday: this.isToday(dayDate),
|
|
50
51
|
timedEvents: events.filter(e => !e.allDay),
|
package/src/utils/DateUtils.js
CHANGED
|
@@ -147,6 +147,14 @@ export class DateUtils extends CoreDateUtils {
|
|
|
147
147
|
return new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(date);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Get full day name
|
|
152
|
+
*/
|
|
153
|
+
static getDayName(dayIndex, locale = 'en-US') {
|
|
154
|
+
const date = new Date(2024, 0, 7 + dayIndex); // Jan 7, 2024 is a Sunday
|
|
155
|
+
return new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date);
|
|
156
|
+
}
|
|
157
|
+
|
|
150
158
|
/**
|
|
151
159
|
* Get month name
|
|
152
160
|
*/
|