From 6914c9db0b74c2ee9be8358987d530b0ca61c0db Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Fri, 10 Apr 2020 18:07:35 -0400 Subject: [PATCH] makes valueAsMoment usage more consistent/idiomatic --- .../super_date_picker/date_popover/absolute_tab.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx b/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx index c2328dab673..aa1a5c16db3 100644 --- a/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx +++ b/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx @@ -58,11 +58,12 @@ export class EuiAbsoluteTab extends Component< if (date === null) { return; } - const dateMoment = moment(date); onChange(typeof date === 'string' ? date : date.toISOString(), event); + + const valueAsMoment = moment(date); this.setState({ - valueAsMoment: dateMoment, - textInputValue: dateMoment.format(this.props.dateFormat), + valueAsMoment, + textInputValue: valueAsMoment.format(this.props.dateFormat), isTextInvalid: false, }); };