Changeset 48912
- Timestamp:
- 08/31/2020 03:56:41 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r48695 r48912 553 553 $comment = get_comment( $comment_ID ); 554 554 555 if ( '' === $format ) {556 $ date = mysql2date( get_option( 'date_format' ), $comment->comment_date);557 } else {558 $date = mysql2date( $format, $comment->comment_date ); 559 }555 if ( ! is_string( $format ) || '' === $format ) { 556 $format = get_option( 'date_format' ); 557 } 558 559 $date = mysql2date( $format, $comment->comment_date ); 560 560 561 561 /** … … 1047 1047 $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; 1048 1048 1049 if ( '' === $format ) {1050 $ date = mysql2date( get_option( 'time_format' ), $comment_date, $translate);1051 } else {1052 $date = mysql2date( $format, $comment_date, $translate ); 1053 }1049 if ( ! is_string( $format ) || '' === $format ) { 1050 $format = get_option( 'time_format' ); 1051 } 1052 1053 $date = mysql2date( $format, $comment_date, $translate ); 1054 1054 1055 1055 /** -
trunk/src/wp-includes/general-template.php
r48870 r48912 2526 2526 } 2527 2527 2528 if ( '' === $format ) {2529 $ the_date = get_post_time( get_option( 'date_format' ), false, $post, true);2530 } else {2531 $the_date = get_post_time( $format, false, $post, true ); 2532 }2528 if ( ! is_string( $format ) || '' === $format ) { 2529 $format = get_option( 'date_format' ); 2530 } 2531 2532 $the_date = get_post_time( $format, false, $post, true ); 2533 2533 2534 2534 /** … … 2655 2655 } 2656 2656 2657 if ( '' === $format ) {2658 $ the_time = get_post_time( get_option( 'time_format' ), false, $post, true);2659 } else {2660 $the_time = get_post_time( $format, false, $post, true ); 2661 }2657 if ( ! is_string( $format ) || '' === $format ) { 2658 $format = get_option( 'time_format' ); 2659 } 2660 2661 $the_time = get_post_time( $format, false, $post, true ); 2662 2662 2663 2663 /** -
trunk/tests/phpunit/tests/date/getPostTime.php
r48911 r48912 11 11 * @ticket 28310 12 12 */ 13 public function test_get_post_time_ with_id_returns_correct_time() {13 public function test_get_post_time_returns_correct_time_with_post_id() { 14 14 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 15 15 16 $this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) ); 16 17 } … … 29 30 * @ticket 28310 30 31 */ 31 public function test_get_post_modified_time_ with_id_returns_correct_time() {32 public function test_get_post_modified_time_returns_correct_time_with_post_id() { 32 33 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 34 33 35 $this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) ); 34 36 } -
trunk/tests/phpunit/tests/date/getTheDate.php
r48911 r48912 11 11 * @ticket 13771 12 12 */ 13 function test_get_the_date_ with_id_returns_correct_time() {13 function test_get_the_date_returns_correct_time_with_post_id() { 14 14 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 15 15 16 $this->assertEquals( 'March 1, 2014', get_the_date( 'F j, Y', $post_id ) ); 16 17 } … … 27 28 28 29 /** 30 * @ticket 51184 31 */ 32 function test_get_the_date_returns_correct_time_with_empty_format() { 33 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); 34 35 $this->assertEquals( 'August 29, 2020', get_the_date( '', $post_id ) ); 36 $this->assertEquals( 'August 29, 2020', get_the_date( false, $post_id ) ); 37 } 38 39 /** 29 40 * @ticket 28310 30 41 */ 31 function test_get_the_time_ with_id_returns_correct_time() {42 function test_get_the_time_returns_correct_time_with_post_id() { 32 43 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 44 33 45 $this->assertEquals( '16:35:00', get_the_time( 'H:i:s', $post_id ) ); 34 46 } … … 43 55 $this->assertFalse( get_the_time( 'h:i:s', 9 ) ); 44 56 } 57 58 /** 59 * @ticket 51184 60 */ 61 function test_get_the_time_returns_correct_time_with_empty_format() { 62 $post_id = self::factory()->post->create( array( 'post_date' => '2020-08-29 01:51:00' ) ); 63 64 $this->assertEquals( '1:51 am', get_the_time( '', $post_id ) ); 65 $this->assertEquals( '1:51 am', get_the_time( false, $post_id ) ); 66 } 45 67 }
Note: See TracChangeset
for help on using the changeset viewer.