Make WordPress Core

Opened 12 years ago

Closed 7 years ago

Last modified 7 years ago

#29063 closed defect (bug) (duplicate)

function current_time( $type, $gmt = 0 ) don't return GMT if 'Y-m-d H:i:s' is pass as type

Reported by: pbearne Owned by: chriscct7
Priority: normal Milestone:
Component: Date/Time Version: 3.8
Severity: normal Keywords: has-patch has-unit-tests bulk-reopened
Cc: Focuses:

Description

Hi Guys

Have been trying to write unit tests for the function current_time() in the functions.php

It works OK if the server/php timezone is GMT but if I run date_default_timezone_set('America/Los_Angeles'); and change the timezone it fails to pass the unit tests

So here are the unit tests and patch that seems to fix it.

It needs better eyes than mine to check this :-) as this a core function

Paul

Attachments (1)

current_time.patch​ (6.3 KB ) - added by pbearne 12 years ago.
unit test and patch for current time()

Download all attachments as: .zip

Change History (11)

@pbearne
12 years ago

unit test and patch for current time()

This ticket was mentioned in IRC in #wordpress-dev by pbearne. ​View the logs.


12 years ago

#3 @SergeyBiryukov
12 years ago

  • Component General → Date/Time

#4 @pbearne
12 years ago

hope the unit tests help

#5 @pbearne
12 years ago

  • Keywords unit-tests added

#6 @tellyworth
12 years ago

  • Version trunk → 3.8

#7 follow-up: @chriscct7
11 years ago

  • Keywords has-patch added; unit-tests removed
  • Owner set to chriscct7
  • Status new → reviewing

Patch still applies. Needs review.

#8 in reply to: ↑ 7 @pbearne
11 years ago

  • Keywords has-unit-tests added

Replying to chriscct7:

Patch still applies. Needs review.

Ping me if we need to change anything to get this in

Paul

#12 @Rarst
7 years ago

  • Keywords bulk-reopened added
  • Resolution → duplicate
  • Status reviewing → closed

Duplicate of #40653.

Folding this into a general rewrite of the function.

Note: See TracTickets for help on using tickets.