Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Use ternary in place of optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemolland committed Oct 5, 2021
1 parent 31ded3e commit 29ee2c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gameflow-tv/flume",
"version": "0.3.13",
"version": "0.3.14",
"description": "React implementation of the Flume design system",
"module": "dist/index.js",
"files": [
Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/inputs/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ export type CalendarProps = {

export const Calendar = forwardRef((props: CalendarProps, ref) => {
const theme = useTheme()
const [selectedDate, setSelectedDate] = useState<number>(props.defaultDate?.valueOf())
const [selectedDate, setSelectedDate] = useState<number>(
props.defaultDate ? props.defaultDate.valueOf() : 0
)
const [month, setMonth] = useState(today.getMonth())
const [year, setYear] = useState(today.getFullYear())
const [monthDetails, setMonthDetails] = useState(
Expand Down Expand Up @@ -296,8 +298,7 @@ export const Calendar = forwardRef((props: CalendarProps, ref) => {
(isSelectedDay(day, selectedDate) ? ' selected' : '')
}
onClick={() => onDateClick(day)}
{...styles}
>
{...styles}>
{day.month !== 0
? !isNullOrUndefined(props.dateBoxDisabledTxt)
? props.dateBoxDisabledTxt
Expand Down

0 comments on commit 29ee2c8

Please sign in to comment.