@@ -68,6 +68,16 @@ export class Datetime implements ComponentInterface {
68
68
private clearFocusVisible ?: ( ) => void ;
69
69
private overlayIsPresenting = false ;
70
70
71
+ /**
72
+ * Whether to highlight the active day with a solid circle (as opposed
73
+ * to the outline circle around today). If you don't specify an initial
74
+ * value for the datetime, it doesn't automatically init to a default to
75
+ * avoid unwanted change events firing. If the solid circle were still
76
+ * shown then, it would look like a date had already been selected, which
77
+ * is misleading UX.
78
+ */
79
+ private highlightActiveParts = false ;
80
+
71
81
private parsedMinuteValues ?: number [ ] ;
72
82
private parsedHourValues ?: number [ ] ;
73
83
private parsedMonthValues ?: number [ ] ;
@@ -1058,6 +1068,7 @@ export class Datetime implements ComponentInterface {
1058
1068
} ;
1059
1069
1060
1070
private processValue = ( value ?: string | null ) => {
1071
+ this . highlightActiveParts = ! ! value ;
1061
1072
const valueToProcess = value || getToday ( ) ;
1062
1073
const { month, day, year, hour, minute, tzOffset } = parseDate ( valueToProcess ) ;
1063
1074
@@ -1349,6 +1360,7 @@ export class Datetime implements ComponentInterface {
1349
1360
}
1350
1361
1351
1362
private renderMonth ( month : number , year : number ) {
1363
+ const { highlightActiveParts } = this ;
1352
1364
const yearAllowed = this . parsedYearValues === undefined || this . parsedYearValues . includes ( year ) ;
1353
1365
const monthAllowed = this . parsedMonthValues === undefined || this . parsedMonthValues . includes ( month ) ;
1354
1366
const isCalMonthDisabled = ! yearAllowed || ! monthAllowed ;
@@ -1424,7 +1436,7 @@ export class Datetime implements ComponentInterface {
1424
1436
class = { {
1425
1437
'calendar-day-padding' : day === null ,
1426
1438
'calendar-day' : true ,
1427
- 'calendar-day-active' : isActive ,
1439
+ 'calendar-day-active' : isActive && highlightActiveParts ,
1428
1440
'calendar-day-today' : isToday ,
1429
1441
} }
1430
1442
aria-selected = { ariaSelected }
@@ -1434,6 +1446,14 @@ export class Datetime implements ComponentInterface {
1434
1446
return ;
1435
1447
}
1436
1448
1449
+ /**
1450
+ * Note that for datetimes with confirm/cancel buttons, the value
1451
+ * isn't updated until you call confirm(). We need to bring the
1452
+ * solid circle back on day click for UX reasons, rather than only
1453
+ * show the circle if `value` is truthy.
1454
+ */
1455
+ this . highlightActiveParts = true ;
1456
+
1437
1457
this . setWorkingParts ( {
1438
1458
...this . workingParts ,
1439
1459
month,
0 commit comments