diff --git a/lib/core/form/components/widgets/core/form-field.model.ts b/lib/core/form/components/widgets/core/form-field.model.ts index 2993564929..035abf82fe 100644 --- a/lib/core/form/components/widgets/core/form-field.model.ts +++ b/lib/core/form/components/widgets/core/form-field.model.ts @@ -398,7 +398,7 @@ export class FormFieldModel extends FormWidgetModel { } break; case FormFieldTypes.DATETIME: - const dateTimeValue = moment(this.value, this.dateDisplayFormat, true); + const dateTimeValue = moment(this.value, this.dateDisplayFormat, true).utc(); if (dateTimeValue && dateTimeValue.isValid()) { /* cspell:disable-next-line */ this.form.values[this.id] = dateTimeValue.format('YYYY-MM-DDTHH:mm:ssZ'); diff --git a/lib/core/form/components/widgets/date-time/date-time.widget.ts b/lib/core/form/components/widgets/date-time/date-time.widget.ts index 1cdcfac80b..5462bc0921 100644 --- a/lib/core/form/components/widgets/date-time/date-time.widget.ts +++ b/lib/core/form/components/widgets/date-time/date-time.widget.ts @@ -15,7 +15,7 @@ * limitations under the License. */ - /* tslint:disable:component-selector */ +/* tslint:disable:component-selector */ import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material'; @@ -75,7 +75,10 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit, this.maxDate = moment(this.field.maxValue, 'YYYY-MM-DDTHH:mm:ssZ'); } } - this.displayDate = moment(this.field.value, this.field.dateDisplayFormat); + this.displayDate = moment(this.field.value, this.field.dateDisplayFormat) + .add( + moment(this.field.value, this.field.dateDisplayFormat).utcOffset(), + 'minutes'); } ngOnDestroy() {