Skip to content

Commit bd8327a

Browse files
Outline today on date picker (#49)
1 parent 1912846 commit bd8327a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Next
4+
- Outline today in the date picker
5+
36
## 2.2.5 - 2022 Dec 13
47
- Fix month/year not updating when `value` is assigned to
58

src/lib/DatePicker.svelte

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
}
2828
}
2929
30+
const todayDate = new Date()
31+
3032
/** Default Date to use */
3133
const defaultDate = new Date()
3234
@@ -301,6 +303,9 @@
301303
class:selected={calendarDay.year === value?.getFullYear() &&
302304
calendarDay.month === value?.getMonth() &&
303305
calendarDay.number === value.getDate()}
306+
class:today={calendarDay.year === todayDate.getFullYear() &&
307+
calendarDay.month === todayDate.getMonth() &&
308+
calendarDay.number === todayDate.getDate()}
304309
class:other-month={calendarDay.month !== browseMonth}
305310
>
306311
<span>{calendarDay.number}</span>
@@ -428,6 +433,10 @@
428433
border: 2px solid transparent
429434
&:hover
430435
border: 1px solid rgba(#808080, 0.08)
436+
&.today
437+
font-weight: 600
438+
border: 2px solid var(--date-picker-today-border, rgba(#808080, 0.3))
439+
&:hover
431440
background-color: rgba(#808080, 0.08)
432441
&.disabled
433442
visibility: hidden

0 commit comments

Comments
 (0)