Skip to content

Commit

Permalink
fix: similar fix for DateRangeField
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Feb 20, 2025
1 parent 5cb8227 commit 05eb5a3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/radix-vue/src/DateRangeField/DateRangeFieldRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ watch([startValue, locale], ([_startValue]) => {
if (_startValue !== undefined) {
startSegmentValues.value = { ...syncSegmentValues({ value: _startValue, formatter }) }
}
else if (Object.values(startSegmentValues.value).every(value => value === null) || _startValue === undefined) {
// If segment has null value, means that user modified it, thus do not reset the segmentValues
else if (Object.values(startSegmentValues.value).every(value => value !== null) && _startValue === undefined) {
startSegmentValues.value = { ...initialSegments }
}
})
Expand All @@ -277,7 +278,8 @@ watch([endValue, locale], ([_endValue]) => {
if (_endValue !== undefined) {
endSegmentValues.value = { ...syncSegmentValues({ value: _endValue, formatter }) }
}
else if (Object.values(endSegmentValues.value).every(value => value === null) || _endValue === undefined) {
// If segment has null value, means that user modified it, thus do not reset the segmentValues
else if (Object.values(endSegmentValues.value).every(value => value !== null) && _endValue === undefined) {
endSegmentValues.value = { ...initialSegments }
}
})
Expand Down

0 comments on commit 05eb5a3

Please sign in to comment.