@cocoar/ui-components 0.1.0-beta.119 → 0.1.0-beta.122
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.
|
@@ -4036,7 +4036,12 @@ class CoarDatePickerComponent extends CoarControlValueAccessor {
|
|
|
4036
4036
|
localizationDataStore = inject(CoarLocalizationDataStore, { optional: true });
|
|
4037
4037
|
overlayRef = null;
|
|
4038
4038
|
/** Current language from localization service (reactive) */
|
|
4039
|
-
currentLanguage =
|
|
4039
|
+
currentLanguage = computed(() => {
|
|
4040
|
+
// Use the language Signal from service if available, otherwise undefined
|
|
4041
|
+
const lang = this.localizationService?.language();
|
|
4042
|
+
console.debug('[CoarDatePicker] currentLanguage computed:', lang);
|
|
4043
|
+
return lang;
|
|
4044
|
+
}, ...(ngDevMode ? [{ debugName: "currentLanguage" }] : []));
|
|
4040
4045
|
// ============================================================
|
|
4041
4046
|
// Inputs
|
|
4042
4047
|
// ============================================================
|
|
@@ -4137,7 +4142,13 @@ class CoarDatePickerComponent extends CoarControlValueAccessor {
|
|
|
4137
4142
|
/** Display value for the input field */
|
|
4138
4143
|
displayValue = signal('', ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
4139
4144
|
/** Days of week header (localized based on locale and firstDayOfWeek) */
|
|
4140
|
-
daysOfWeek = computed(() =>
|
|
4145
|
+
daysOfWeek = computed(() => {
|
|
4146
|
+
const locale = this.effectiveLocale();
|
|
4147
|
+
const firstDay = this.firstDayOfWeek();
|
|
4148
|
+
const days = getLocalizedWeekdays(locale, firstDay);
|
|
4149
|
+
console.debug('[CoarDatePicker] daysOfWeek - locale:', locale, 'firstDay:', firstDay, 'days:', days);
|
|
4150
|
+
return days;
|
|
4151
|
+
}, ...(ngDevMode ? [{ debugName: "daysOfWeek" }] : []));
|
|
4141
4152
|
/** Reference to the input element */
|
|
4142
4153
|
inputRef = viewChild('dateInput', ...(ngDevMode ? [{ debugName: "inputRef" }] : []));
|
|
4143
4154
|
/** Reference to the trigger element */
|
|
@@ -4212,7 +4223,11 @@ class CoarDatePickerComponent extends CoarControlValueAccessor {
|
|
|
4212
4223
|
* Priority: input locale > locale service language > browser locale
|
|
4213
4224
|
*/
|
|
4214
4225
|
effectiveLocale = computed(() => {
|
|
4215
|
-
|
|
4226
|
+
const localeInput = this.locale();
|
|
4227
|
+
const currentLang = this.currentLanguage();
|
|
4228
|
+
const effective = localeInput ?? currentLang ?? navigator.language;
|
|
4229
|
+
console.debug('[CoarDatePicker] effectiveLocale - input:', localeInput, 'currentLang:', currentLang, 'effective:', effective);
|
|
4230
|
+
return effective;
|
|
4216
4231
|
}, ...(ngDevMode ? [{ debugName: "effectiveLocale" }] : []));
|
|
4217
4232
|
/** Whether the picker has an error state */
|
|
4218
4233
|
hasError = computed(() => this.error(), ...(ngDevMode ? [{ debugName: "hasError" }] : []));
|
|
@@ -4266,11 +4281,14 @@ class CoarDatePickerComponent extends CoarControlValueAccessor {
|
|
|
4266
4281
|
/** Month name for calendar header */
|
|
4267
4282
|
viewMonth = computed(() => {
|
|
4268
4283
|
const viewMonth = this.viewDate();
|
|
4269
|
-
const
|
|
4284
|
+
const locale = this.effectiveLocale();
|
|
4285
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
4270
4286
|
month: 'long',
|
|
4271
4287
|
});
|
|
4272
4288
|
const jsDate = new Date(viewMonth.year, viewMonth.month - 1, 1);
|
|
4273
|
-
|
|
4289
|
+
const monthName = formatter.format(jsDate);
|
|
4290
|
+
console.debug('[CoarDatePicker] viewMonth - locale:', locale, 'month:', viewMonth.month, 'name:', monthName);
|
|
4291
|
+
return monthName;
|
|
4274
4292
|
}, ...(ngDevMode ? [{ debugName: "viewMonth" }] : []));
|
|
4275
4293
|
/** Year for calendar header */
|
|
4276
4294
|
viewYear = computed(() => {
|