Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckySharma014 committed Oct 12, 2023
2 parents b211a05 + a0eee23 commit d455136
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions libs/ui/src/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const DatePicker = (props: DatePicker) => {
<Calendar
{...props}
mode="single"
showOutsideDays
selected={selected}
onSelect={setSelected}
defaultMonth={selected}
Expand Down
15 changes: 8 additions & 7 deletions libs/ui/src/date-picker/range-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ export const RangePicker = ({ className, ...props }: RangePicker) => {
props.selected,
);

const display = [];
let display = "";
if (selected?.from)
display.push(
props.formatters?.formatDay?.(selected.from) ??
format(selected.from, "longDate"),
);
display +=
String(
props.formatters?.formatDay?.(selected.from) ??
format(selected.from, "longDate"),
) + " - ";
if (selected?.to)
display.push(
display += String(
props.formatters?.formatDay?.(selected.to) ??
format(selected.to, "longDate"),
);
Expand All @@ -58,7 +59,7 @@ export const RangePicker = ({ className, ...props }: RangePicker) => {
)}
leftIcon={<CalendarIcon className="h-4 w-4" />}
>
{display.length !== 0 ? display.join(" - ") : "Pick a range"}
{display.length !== 0 ? display : "Pick a range"}
<div className="flex-1" />
{selected && (
<div
Expand Down

0 comments on commit d455136

Please sign in to comment.