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 a few minor datetime bugs #757

Merged
merged 4 commits into from Jul 22, 2019
Merged

Fix a few minor datetime bugs #757

merged 4 commits into from Jul 22, 2019

Conversation

ohmoses
Copy link
Contributor

@ohmoses ohmoses commented Jul 21, 2019

I put a few fixes together into a single PR, because they're tiny.

Bugs fixed:

  1. When manually typing a date into a date input field, the app would go into an infinite loop and freeze.
  2. When manually typing the date, after going from an invalid value to a valid one, the cursor would jump to the end of the input.
  3. The date input field would not allow deleting the value completely.

Also, I fixed an unrelated potential bug in TextInput (in fortunately otherwise unused code):

const {oldHeightType} = oldProps

changed to

const {heightType: oldHeightType} = oldProps

@@ -141,26 +141,24 @@ export default class TextInputWithDatePicker extends React.Component {
const {value} = event.target
const newDate = new DateTime(event.target.value, format)

if (value.length > 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you have 'hide whitespace changes' checked, otherwise the diff looks more complicated than it is 🙂

const parsedDate =
// Fecha requires a format. If no format is specified, try ISO.
fecha.parse(date, format || FORMAT_ISO8601) ||
// If format is specified but parsing fails, the value has probably been
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If format is specified but parsing fails, the value has probably been
// If format is specified but parsing fails, the value has probably been

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, sorry, prettier doesn't like that 😁

@ohmoses ohmoses merged commit e1e4c89 into develop Jul 22, 2019
@ohmoses ohmoses deleted the fix/datetime branch July 22, 2019 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants