Skip to content

Commit

Permalink
console: Update duration encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaplots committed Sep 19, 2022
1 parent 56b77e1 commit ab88df6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/webui/components/unit-input/common/duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ const units = [
{ label: sharedMessages.hours, value: 'h' },
]

const encoder = (value, unit) => (value ? `${value}${unit}` : null)
const encoder = (value, unit) => {
if (value === null) {
return null
}

return value ? `${value}${unit}` : unit
}
const decoder = (rawValue = '') => {
if (rawValue === null) {
return { value: '', unit: null }
Expand Down

0 comments on commit ab88df6

Please sign in to comment.