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

Analytics chart data bumped up when previous year contains 29th February #47503

Open
ilyasfoo opened this issue May 15, 2024 · 0 comments
Open
Labels
focus: analytics plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: TBD Issues in areas where there is no team doing active development. type: bug The issue is a confirmed bug.

Comments

@ilyasfoo
Copy link
Contributor

Issue description

Recreated from previous issue #32259.

Analytics time-comparison chart's previous year data will exclude 29 February when:

  1. Date range does not contain 29th February
  2. Previous year range contains 29th February
  3. Compare to previous year
  4. Chart is shown By day

This means reports such as quarterly reports, half-yearly reports, and annual reports can be affected if February 29 is present in the date range OR the respective comparison year, e.g. reports in 2024 and 2025 are affected.

Note: There's a challenge with the way we're rendering our charts, it only accepts a valid date in the x-axis. The x-axis is mapped via primary date range, thus 29th February of a given non-leap year will always be invalid. This means a quick solution such as adding a dummy datapoint in place of 29th February is also impossible without customizing how we render the x-axis with D3.js.

To reproduce:

  1. Download and install wc-smooth-generator plugin
  2. Run the following commands in wp-cli:

wp wc generate orders 1 --date-start=2020-02-29 --date-end=2020-02-29 --status=completed &&
wp wc generate orders 1 --date-start=2020-03-10 --date-end=2020-03-10 --status=completed
  1. Go to Analytics > Settings and set Date type to Date created and save
  2. Go to Analytics > Orders and set Date range to custom tab, 01/01/2021 to 03/31/2021 and update
  3. Observe despite having an order dated 29th February 2020, it does not have 29th February in chart. Instead, the data is bumped up to 1st March 2020 (screenshot)
  4. For clarity that it affects further than 29th Feb, observe 10th March 2020 data is also bumped up to 11th March 2020 (screenshot)

Acceptance criteria

  1. Previous year data in chart should reflect the respective dates accurately.
@ilyasfoo ilyasfoo added type: bug The issue is a confirmed bug. team: TBD Issues in areas where there is no team doing active development. focus: analytics labels May 15, 2024
@ilyasfoo ilyasfoo added priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. plugin: woocommerce Issues related to the WooCommerce Core plugin. labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: analytics plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: TBD Issues in areas where there is no team doing active development. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

1 participant