Skip to content

Wrong flight logic #1473

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

Merged
merged 4 commits into from
Feb 6, 2022
Merged

Wrong flight logic #1473

merged 4 commits into from
Feb 6, 2022

Conversation

tanquar
Copy link
Contributor

@tanquar tanquar commented Jan 30, 2022

Description of Problem

In example - flight,

  1. condition for showing the warning message was logically flipped.
  2. date comparison makes errors around end of month. Note that new Date() is zero-based.

Proposed Solution

  1. Add !
  2. Use 0-11 for month value

Additional Information

I also added "value" for option, for ease with translation projects.

@netlify
Copy link

netlify bot commented Jan 30, 2022

✔️ Deploy Preview for vue-docs-preview ready!

🔨 Explore the source changes: 02b6f39

🔍 Inspect the deploy log: https://app.netlify.com/sites/vue-docs-preview/deploys/61f63157e21d0400072ba7cf

😎 Browse the preview: https://deploy-preview-1473--vue-docs-preview.netlify.app

@yyx990803
Copy link
Member

I'm not sure what you mean by "condition for showing the warning message was logically flipped." - your change to the message seems to do the exact same thing as existing code.

@tanquar
Copy link
Contributor Author

tanquar commented Feb 3, 2022

Thank you for your comment.

The logic correction is in
2ef65ff
where !this.isReturn is correct, previously this.isReturn.

Previous this.isReturn will show the warning message in unwanted situation,
i.e. choosing single trip shows error message for return trip,
and choosing return trip shows no error message for return trip.

Correcting into !this.isReturn will fix this,
i.e. choosing single trip shows no error message for return trip,
and choosing return trip shows error message for return trip.

Following pieces of my commits do the same thing. These are adjustment for "ease with translation".
eeaa0f2
08cd98c

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

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

Just to confirm, there are two bugs fixed here:

  1. Travel dates of 2022/01/31 and 2022/02/02 will incorrectly report that the first date is after the first date. This is because of the missing m - 1, leading to 2022/01/31 being treated as March 3rd and 2022/02/02 as March 2nd.
  2. The logic for canBook is flipped in the Options API example. It is correct for the Composition API example.

@skirtles-code skirtles-code merged commit 985ef3c into vuejs:main Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants