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 invalid date format errors in certain languages #46932

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

nathanss
Copy link
Contributor

@nathanss nathanss commented Apr 25, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

The issue was happening due to moment not being able to parse the date without having the correct format informed.

I copied some code from gutenberg, mostly a map from PHP date formats and moment date formats, since it is not exposed in the module. It was needed to make it work. I plan on creating a follow-up issue to maybe have this object exposed upstream after this issue gets reviewed.

Closes #44216 .

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Switch WordPress language to Simplified Chinese (简体中文) in Settings > General.
  2. Enable the new product editor at /wp-admin/admin.php?page=wc-settings&tab=advanced&section=features
  3. Go to Products > Add
  4. Fill name
  5. Go to Pricing tab, fill a valid combination of list and sale price
  6. Check "schedule sale"
  7. Pick a valid combination of "from" and "to" dates.
  8. You should not see a validation error.
  9. Test with other languages to check for regressions.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@nathanss nathanss self-assigned this Apr 25, 2024
@github-actions github-actions bot added the package: @woocommerce/components issues related to @woocommerce/components label Apr 25, 2024
Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

Tested well, although I rather dislike how long and convoluted the date time picker control has become. I don't know what is going on for the most part there appears to be a lot of different formatting going on.
I wonder if we can simplify it and with that just be able to make use of the format function from wordpress date.

@louwie17 louwie17 merged commit 6d914ff into trunk Apr 26, 2024
19 checks passed
@louwie17 louwie17 deleted the fix/invalid-date-formats branch April 26, 2024 09:28
@github-actions github-actions bot added this to the 9.0.0 milestone Apr 26, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Apr 26, 2024
samueljseay pushed a commit that referenced this pull request Apr 29, 2024
* Fix invalid date format errors in certain languages

* Remove rest of jsdoc
@rodelgc rodelgc added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. package: @woocommerce/components issues related to @woocommerce/components status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

block editor product -> Schedule sale -> BUG
3 participants