Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export class DateTimeComponent extends FieldBase implements OnInit, OnDestroy {
}

fieldOnDateChange(event: any) {
// owl picker emits null when the typed text can't be parsed; clear the input instead of defaulting to now
if (!event.value) {
this.fieldControl.setValue('');
handleEvent(this.actionsApi, 'changeNblur', this.propName, '');
return;
}
// this comes from the date pop up
if (typeof event.value === 'object') {
// convert date to pega "date" format
Expand All @@ -104,4 +110,25 @@ export class DateTimeComponent extends FieldBase implements OnInit, OnDestroy {
}
handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
}

override getErrorMessage() {
// look for validation messages for json, pre-defined or just an error pushed from workitem (400)
if (this.fieldControl.hasError('message')) {
return this.angularPConnectData.validateMessage ?? '';
}

if (this.fieldControl.hasError('required')) {
return 'You must enter a value';
}

if (this.fieldControl.hasError('owlDateTimeParse')) {
return `${this.fieldControl.errors?.['owlDateTimeParse'].text} is not a valid date time value`;
}

if (this.fieldControl.errors) {
return 'Invalid date time value';
}

return '';
}
}
Loading