Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/16425: Using localize in new date picker #16456

Merged
merged 2 commits into from
Mar 24, 2023
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
8 changes: 5 additions & 3 deletions src/components/NewDatePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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] : []}
Expand Down Expand Up @@ -162,7 +164,7 @@ 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 */
<NewDatePicker {...props} innerRef={ref} />
));
)));