From 7e035b514ad05e446f4716badc7377ae03d69a40 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 23 Mar 2023 23:31:39 +0700 Subject: [PATCH 1/2] fix: using localize in new date picker --- src/components/NewDatePicker/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/NewDatePicker/index.js b/src/components/NewDatePicker/index.js index c5df338f4206..9c2ebf80f0ac 100644 --- a/src/components/NewDatePicker/index.js +++ b/src/components/NewDatePicker/index.js @@ -9,8 +9,10 @@ import styles from '../../styles/styles'; import * as Expensicons from '../Icon/Expensicons'; import {propTypes as datePickerPropTypes, defaultProps as defaultDatePickerProps} from './datePickerPropTypes'; import KeyboardShortcut from '../../libs/KeyboardShortcut'; +import withLocalize, {withLocalizePropTypes} from '../withLocalize'; const propTypes = { + ...withLocalizePropTypes, ...datePickerPropTypes, }; @@ -127,7 +129,7 @@ class NewDatePicker extends React.Component { label={this.props.label} value={this.props.value || ''} defaultValue={this.defaultValue} - placeholder={this.props.placeholder || CONST.DATE.MOMENT_FORMAT_STRING} + placeholder={this.props.placeholder || this.props.translate('common.dateFormat')} errorText={this.props.errorText} containerStyles={this.props.containerStyles} textInputContainerStyles={this.state.isPickerVisible ? [styles.borderColorFocus] : []} @@ -162,7 +164,8 @@ class NewDatePicker extends React.Component { NewDatePicker.propTypes = propTypes; NewDatePicker.defaultProps = datePickerDefaultProps; -export default React.forwardRef((props, ref) => ( +export default +withLocalize(React.forwardRef((props, ref) => ( /* eslint-disable-next-line react/jsx-props-no-spreading */ -)); +))); From bce2c8ba73e7e41d90a5a9372707ad7d7df84bb5 Mon Sep 17 00:00:00 2001 From: tienifr <113963320+tienifr@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:38:46 +0700 Subject: [PATCH 2/2] Update src/components/NewDatePicker/index.js Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np> --- src/components/NewDatePicker/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/NewDatePicker/index.js b/src/components/NewDatePicker/index.js index 9c2ebf80f0ac..7443fa7766e3 100644 --- a/src/components/NewDatePicker/index.js +++ b/src/components/NewDatePicker/index.js @@ -164,8 +164,7 @@ class NewDatePicker extends React.Component { NewDatePicker.propTypes = propTypes; NewDatePicker.defaultProps = datePickerDefaultProps; -export default -withLocalize(React.forwardRef((props, ref) => ( +export default withLocalize(React.forwardRef((props, ref) => ( /* eslint-disable-next-line react/jsx-props-no-spreading */ )));