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

Date range is displayed incorrectly when start and end dates are on same day of the month #359

Closed
dboulet opened this issue Apr 10, 2016 · 2 comments
Labels
Milestone

Comments

@dboulet
Copy link

dboulet commented Apr 10, 2016

I have an event which begins on April 9th, and ends on May 9th. I output the date in my theme using this code:

eo_format_event_occurrence( FALSE, FALSE, 'l, F j, Y', '', '–', FALSE );

The date is displayed like this:

Saturday, April–Monday, May 9, 2016

It should be:

Saturday, April 9–Monday, May 9, 2016

The day in the start date is missing.

@stephenharris
Copy link
Owner

The date formatting is a bit naive here. It starts from both ends and finds where the dates first differ (in the rendered format). To illustrate this, if 9th May 2016 was in fact a Saturday, it would look like:

Saturday, April-May 9, 2016

So it splits the dates where they first differ going from left-to-right and right-to-left.

The bug here is that '9' here is the same for start and end date but they don't actually refer to the same 9th. I think there needs to some added logic here to the effect:

  • If the year differs, don't group year/month/day tokens
  • If the month differs, don't group month/day tokens
  • If the date differs, don't group day tokens

@stephenharris stephenharris added this to the 3.1.0 milestone May 11, 2016
@dboulet
Copy link
Author

dboulet commented May 11, 2016

Thanks for your work on this, @stephenharris!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants