Skip to content

Commit

Permalink
FIO-7184 Added code for a missing condition
Browse files Browse the repository at this point in the history
  • Loading branch information
antonSoftensity committed Nov 20, 2023
1 parent 38dd9ff commit 8f6efc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/datetime/DateTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,14 @@ export default class DateTimeComponent extends Input {
const timezone = this.timezone;
if (value && !this.attached && timezone) {
if (Array.isArray(value) && this.component.multiple) {
return value.map((item) => _.trim(FormioUtils.momentDate(item, format, timezone).format(format))).join(', ');
return value.map(item => _.trim(FormioUtils.momentDate(item, format, timezone).format(format))).join(', ');
}
return _.trim(FormioUtils.momentDate(value, format, timezone).format(format));
}

if (Array.isArray(value) && this.component.multiple) {
return value.map(item => _.trim(moment(item).format(format))).join(', ');
}
return (value ? _.trim(moment(value).format(format)) : value) || '';
}
}
2 changes: 1 addition & 1 deletion src/components/time/Time.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default class TimeComponent extends TextFieldComponent {

getValueAsString(value) {
if (Array.isArray(value) && this.component.multiple) {
return value.map((item) => moment(item, this.component.dataFormat).format(this.component.format)).join(', ');
return value.map(item => moment(item, this.component.dataFormat).format(this.component.format)).join(', ');
}
return (value ? moment(value, this.component.dataFormat).format(this.component.format) : value) || '';
}
Expand Down

0 comments on commit 8f6efc6

Please sign in to comment.