WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#34279 closed defect (bug) (fixed)

if no timezone is set "get_gmt_from_date()" needs the date to be in 'Y-m-d H:i:s' when 'Y-m-d' works if timezone set

Reported by: pbearne Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: Date/Time Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

in the unit test we create posts we just a year e.g. test_validate_date_values_should_process_array_value_for_year this fails as "get_gmt_from_date()" needs the date to be in 'Y-m-d H:i:s' when get_option( 'timezone_string' ) is false.

This patch allows you pass in date string and for the correct date to be returned

Attachments (3)

34279.patch (3.1 KB) - added by pbearne 4 years ago.
patch and unit tests
34279.2.patch (3.4 KB) - added by pbearne 4 years ago.
patch with whitespaces fixed
34279.3.patch (3.6 KB) - added by pbearne 4 years ago.
I updated devop to the latest version and re made the patch so I hope it patch OK now

Download all attachments as: .zip

Change History (9)

@pbearne
4 years ago

patch and unit tests

#2 @pbearne
4 years ago

Related: ##28992

#3 @pbearne
4 years ago

  • Keywords has-patch has-unit-tests added

#4 @swissspidy
4 years ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 4.4

Except from some missing spaces around braces this looks good to me.

Any objections?

@pbearne
4 years ago

patch with whitespaces fixed

@pbearne
4 years ago

I updated devop to the latest version and re made the patch so I hope it patch OK now

#5 @pbearne
4 years ago

  • Keywords needs-refresh removed

#6 @wonderboymusic
3 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 35284:

Formatting: allow date strings to be passed to get_gmt_from_date(), instead of requiring 'Y-m-d H:i:s'.

Adds unit tests.

Props pbearne.
Fixes #34279.

Note: See TracTickets for help on using tickets.