Skip to content

Commit

Permalink
fix: cv-datepicker allow empty label
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnixon committed Mar 9, 2024
1 parent 8b032ab commit fb54660
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/components/CvDatePicker/CvDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'single',
'range',
].includes(getKind),
[`${carbonPrefix}--date-picker--nolabel`]: getDateLabel !== undefined,
[`${carbonPrefix}--date-picker--nolabel`]: !getDateLabel,
}"
>
<label
Expand Down Expand Up @@ -191,18 +191,16 @@ const getKind = computed({
},
});
const getDateLabel = computed({
get() {
if (props.kind === 'range' && !props.dateLabel) {
const getDateLabel = computed(() => {
if (props.dateLabel !== undefined) {
return props.dateLabel;
} else {
if (props.kind === 'range') {
return 'Start date';
} else {
return 'Date';
}
if (!props.dateLabel) {
return 'Date label';
}
return props.dateLabel;
},
}
});
const isRange = computed(() => {
Expand Down

0 comments on commit fb54660

Please sign in to comment.