Skip to content

Commit 448d170

Browse files
- change datetime attribute naming;
1 parent cceacd7 commit 448d170

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

core/src/components/datetime/datetime-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface DatetimeParts {
1515
hour?: number;
1616
minute?: number;
1717
ampm?: 'am' | 'pm';
18-
adjacentDay?: boolean;
18+
isAdjacentDay?: boolean;
1919
}
2020

2121
export type DatetimePresentation = 'date-time' | 'time-date' | 'date' | 'time' | 'month' | 'year' | 'month-year';

core/src/components/datetime/datetime.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class Datetime implements ComponentInterface {
139139
hour: 13,
140140
minute: 52,
141141
ampm: 'pm',
142-
adjacentDay: false,
142+
isAdjacentDay: false,
143143
};
144144

145145
@Element() el!: HTMLIonDatetimeElement;
@@ -2240,11 +2240,11 @@ export class Datetime implements ComponentInterface {
22402240
>
22412241
<div class="calendar-month-grid">
22422242
{getDaysOfMonth(month, year, this.firstDayOfWeek % 7, this.showAdjacentDays).map((dateObject, index) => {
2243-
const { day, dayOfWeek, adjacentDay } = dateObject;
2243+
const { day, dayOfWeek, isAdjacentDay } = dateObject;
22442244
const { el, highlightedDates, isDateEnabled, multiple, showAdjacentDays } = this;
22452245
let _month = month;
22462246
let _year = year;
2247-
if (showAdjacentDays && adjacentDay && day !== null) {
2247+
if (showAdjacentDays && isAdjacentDay && day !== null) {
22482248
if (day > 20) {
22492249
// Leading with the adjacent day from the previous month
22502250
// if its a adjacent day and is higher than '20' (last week even in feb)
@@ -2266,7 +2266,7 @@ export class Datetime implements ComponentInterface {
22662266
}
22672267
}
22682268

2269-
const referenceParts = { month: _month, day, year: _year, adjacentDay };
2269+
const referenceParts = { month: _month, day, year: _year, isAdjacentDay };
22702270
const isCalendarPadding = day === null;
22712271
const {
22722272
isActive,
@@ -2321,19 +2321,19 @@ export class Datetime implements ComponentInterface {
23212321
* Custom highlight styles should not override the style for selected dates,
23222322
* nor apply to "filler days" at the start of the grid.
23232323
*/
2324-
if (highlightedDates !== undefined && !isActive && day !== null && !adjacentDay) {
2324+
if (highlightedDates !== undefined && !isActive && day !== null && !isAdjacentDay) {
23252325
dateStyle = getHighlightStyles(highlightedDates, dateIsoString, el);
23262326
}
23272327

23282328
let dateParts = undefined;
23292329

23302330
// "Filler days" at the beginning of the grid should not get the calendar day
23312331
// CSS parts added to them
2332-
if (!isCalendarPadding && !adjacentDay) {
2332+
if (!isCalendarPadding && !isAdjacentDay) {
23332333
dateParts = `calendar-day${isActive ? ' active' : ''}${isToday ? ' today' : ''}${
23342334
isCalDayDisabled ? ' disabled' : ''
23352335
}`;
2336-
} else if (adjacentDay) {
2336+
} else if (isAdjacentDay) {
23372337
dateParts = `calendar-day${isCalDayDisabled ? ' disabled' : ''}`;
23382338
}
23392339

@@ -2369,7 +2369,7 @@ export class Datetime implements ComponentInterface {
23692369
'calendar-day-active': isActive,
23702370
'calendar-day-constrained': isCalDayConstrained,
23712371
'calendar-day-today': isToday,
2372-
'calendar-day-adjacent-day': adjacentDay,
2372+
'calendar-day-adjacent-day': isAdjacentDay,
23732373
}}
23742374
part={dateParts}
23752375
aria-hidden={isCalendarPadding ? 'true' : null}
@@ -2380,7 +2380,7 @@ export class Datetime implements ComponentInterface {
23802380
return;
23812381
}
23822382

2383-
if (adjacentDay) {
2383+
if (isAdjacentDay) {
23842384
// The user selected a day outside the current month. Ignore this button, as the month will be re-rendered.
23852385
this.el.blur();
23862386
}
@@ -2390,7 +2390,7 @@ export class Datetime implements ComponentInterface {
23902390
month: _month,
23912391
day,
23922392
year: _year,
2393-
adjacentDay: adjacentDay,
2393+
isAdjacentDay: isAdjacentDay,
23942394
});
23952395

23962396
// multiple only needs date info, so we can wipe out other fields like time
@@ -2400,7 +2400,7 @@ export class Datetime implements ComponentInterface {
24002400
month: _month,
24012401
day,
24022402
year: _year,
2403-
adjacentDay: adjacentDay,
2403+
isAdjacentDay: isAdjacentDay,
24042404
},
24052405
isActive
24062406
);
@@ -2410,7 +2410,7 @@ export class Datetime implements ComponentInterface {
24102410
month: _month,
24112411
day,
24122412
year: _year,
2413-
adjacentDay: adjacentDay,
2413+
isAdjacentDay: isAdjacentDay,
24142414
});
24152415
}
24162416
}}

core/src/components/datetime/utils/data.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,22 @@ export const getDaysOfMonth = (month: number, year: number, firstDayOfWeek: numb
140140
| {
141141
day: number;
142142
dayOfWeek: number;
143-
adjacentDay: boolean;
143+
isAdjacentDay: boolean;
144144
}
145145
| {
146146
day: null;
147147
dayOfWeek: null;
148-
adjacentDay: boolean;
148+
isAdjacentDay: boolean;
149149
}
150150
)[] = [];
151151
for (let i = 1; i <= numDays; i++) {
152-
days.push({ day: i, dayOfWeek: (offset + i) % 7, adjacentDay: false });
152+
days.push({ day: i, dayOfWeek: (offset + i) % 7, isAdjacentDay: false });
153153
}
154154

155155
if (showAdjacentDays) {
156156
for (let i = 0; i <= offset; i++) {
157157
// Using offset create previous month adjacent day, starting from last day
158-
days = [{ day: previousNumDays - i, dayOfWeek: (previousNumDays - i) % 7, adjacentDay: true }, ...days];
158+
days = [{ day: previousNumDays - i, dayOfWeek: (previousNumDays - i) % 7, isAdjacentDay: true }, ...days];
159159
}
160160

161161
// Calculate positiveOffset
@@ -164,11 +164,11 @@ export const getDaysOfMonth = (month: number, year: number, firstDayOfWeek: numb
164164
// minus (the previous offset + the current month days)
165165
const positiveOffset = 41 - (numDays + offset);
166166
for (let i = 0; i < positiveOffset; i++) {
167-
days.push({ day: i + 1, dayOfWeek: (numDays + offset + i) % 7, adjacentDay: true });
167+
days.push({ day: i + 1, dayOfWeek: (numDays + offset + i) % 7, isAdjacentDay: true });
168168
}
169169
} else {
170170
for (let i = 0; i <= offset; i++) {
171-
days = [{ day: null, dayOfWeek: null, adjacentDay: false }, ...days];
171+
days = [{ day: null, dayOfWeek: null, isAdjacentDay: false }, ...days];
172172
}
173173
}
174174

0 commit comments

Comments
 (0)