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: fix DateTimePicker text capitalization #2279

Merged
merged 4 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/DateTimePicker/helpers/formatDateTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export default function formatDateTime(
const options = FORMATS[formatStyle] || FORMATS.medium;
const value = typeof date === 'string' ? new Date(date) : date;
const timeFormat = hour24 ? timeFormat24h : timeFormat12h;
return new Intl.DateTimeFormat(locale, { ...options, ...timeFormat }).format(value);
return new Intl.DateTimeFormat(locale, {
...options,
...timeFormat,
}).format(value);
} catch (error) {
console.error(error);
return '';
Expand Down
4 changes: 2 additions & 2 deletions src/components/DateTimePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import React, { useRef, useEffect, useState, useImperativeHandle, useContext } from 'react';
import PropTypes from 'prop-types';
import withReduxForm from '../../libs/hocs/withReduxForm';
import Input from '../Input';
import DateTimeIcon from './icon';
import DateTimePickerModal from './pickerModal';
import formatDateTime from './helpers/formatDateTime';
import { ENTER_KEY, SPACE_KEY } from '../../libs/constants';
import StyledContainer from './styled/container';
import StyledInput from './styled/input';
import { AppContext } from '../Application/context';
import { getLocale } from '../../libs/utils';

Expand Down Expand Up @@ -105,7 +105,7 @@ const DateTimePicker = React.forwardRef((props, ref) => {

return (
<StyledContainer id={id} className={className} style={style}>
<StyledInput
<Input
ref={inputRef}
label={label}
placeholder={placeholder}
Expand Down
8 changes: 0 additions & 8 deletions src/components/DateTimePicker/styled/input.js

This file was deleted.