Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#47463 closed enhancement (fixed)

Refactor from using invalid timestamps in event filtering

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

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 7 years ago.

Download all attachments as: .zip

Change History (4)

#1 @Rarst
7 years ago

  • Summary Refactor from using invalid timestamps in event filtreing → Refactor from using invalid timestamps in event filtering

#2 @SergeyBiryukov
7 years ago

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

#3 @SergeyBiryukov
7 years ago

  • Resolution → fixed
  • Status reviewing → 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.