WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 weeks ago

#47463 closed enhancement (fixed)

Refactor from using invalid timestamps in event filtering

Reported by: Rarst Owned by: SergeyBiryukov
Milestone: 5.3 Priority: low
Severity: minor Version:
Component: Date/Time Keywords: has-patch
Focuses: Cc:

Description

Event API sends WordCamp and Meetup data with date/time lacking time zone information (see https://meta.trac.wordpress.org/ticket/4480 )

The current implementation of filtering for upcoming events tries to parse that into timestamps (which doesn't really work) and determine upcoming events by comparing against "WP timestamp" summed with time zone offset (which isn't really appropriate for the task, or ever).

Patch simplifies the logic to date comparison and removes reliance on WP timestamp.

Parent issue #40657

Attachments (1)

trim-events.patch (1.2 KB) - added by Rarst 4 months ago.

Download all attachments as: .zip

Change History (4)

@Rarst
4 months ago

#1 @Rarst
4 months ago

  • Summary changed from Refactor from using invalid timestamps in event filtreing to Refactor from using invalid timestamps in event filtering

#2 @SergeyBiryukov
4 months ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
4 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45886:

Date/Time: Simplify the date comparing logic in WP_Community_Events::trim_events().

The Events API returns event date without timezone information, so trying to parse it into a timestamp and compare to a WP timestamp is pointless.

Props Rarst.
Fixes #47463.

Note: See TracTickets for help on using tickets.