Make WordPress Core

Opened 11 years ago

Closed 11 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
Priority: normal Milestone: 4.4
Component: Date/Time Version: 4.4
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

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 11 years ago.
patch and unit tests
34279.2.patch​ (3.4 KB ) - added by pbearne 11 years ago.
patch with whitespaces fixed
34279.3.patch​ (3.6 KB ) - added by pbearne 11 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
11 years ago

patch and unit tests

#2 @pbearne
11 years ago

Related: ##28992

#3 @pbearne
11 years ago

  • Keywords has-patch has-unit-tests added

#4 @swissspidy
11 years ago

  • Keywords needs-refresh added
  • Milestone Awaiting Review → 4.4

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

Any objections?

@pbearne
11 years ago

patch with whitespaces fixed

@pbearne
11 years ago

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

#5 @pbearne
11 years ago

  • Keywords needs-refresh removed

#6 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution → fixed
  • Status new → 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.