Changeset 60891
- Timestamp:
- 10/02/2025 09:46:07 PM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/wp-admin/css/forms.css (modified) (1 diff)
-
src/wp-admin/includes/class-wp-privacy-requests-table.php (modified) (2 diffs)
-
tests/phpunit/tests/admin/wpPrivacyRequestsTable.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/forms.css
r60885 r60891 1454 1454 } 1455 1455 1456 .privacy_requests .status-date { 1457 display: block; 1458 font-weight: 400; 1459 } 1460 1456 1461 .wp-privacy-request-form { 1457 1462 clear: both; -
trunk/src/wp-admin/includes/class-wp-privacy-requests-table.php
r60072 r60891 462 462 463 463 if ( $timestamp ) { 464 echo ' (' . $this->get_timestamp_as_date( $timestamp ) . ')';464 echo '<span class="status-date">' . $this->get_timestamp_as_date( $timestamp ) . '</span>'; 465 465 } 466 466 … … 488 488 } 489 489 490 return date_i18n( get_option( 'date_format' ), $timestamp ); 490 return sprintf( 491 /* translators: 1: privacy request date format, 2: privacy request time format. */ 492 __( '%1$s at %2$s' ), 493 /* translators: privacy request date format. See https://www.php.net/manual/en/datetime.format.php */ 494 date_i18n( __( 'Y/m/d' ), $timestamp ), 495 /* translators: privacy request time format. See https://www.php.net/manual/en/datetime.format.php */ 496 date_i18n( __( 'g:i a' ), $timestamp ) 497 ); 491 498 } 492 499 -
trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php
r60729 r60891 210 210 $this->assertSame( $expected, $this->get_mocked_class_instance()->get_views() ); 211 211 } 212 213 /** 214 * Test the get_timestamp_as_date method formats timestamps correctly. 215 * 216 * @ticket 44267 217 * 218 * @covers WP_Privacy_Requests_Table::get_timestamp_as_date 219 */ 220 public function test_get_timestamp_as_date() { 221 $table = $this->get_mocked_class_instance(); 222 223 $reflection = new ReflectionClass( $table ); 224 $method = $reflection->getMethod( 'get_timestamp_as_date' ); 225 $method->setAccessible( true ); 226 227 $date_format = __( 'Y/m/d' ); 228 $time_format = __( 'g:i a' ); 229 230 $current_time = time(); 231 232 $this->assertSame( '', $method->invoke( $table, '' ) ); 233 234 // Test recent timestamp (less than 24 hours ago). 235 $recent_time = $current_time - HOUR_IN_SECONDS; 236 $result = $method->invoke( $table, $recent_time ); 237 $this->assertStringContainsString( 'ago', $result ); 238 239 $old_time = $current_time - 2 * DAY_IN_SECONDS; 240 $result = $method->invoke( $table, $old_time ); 241 242 $date_part = date_i18n( $date_format, $old_time ); 243 $time_part = date_i18n( $time_format, $old_time ); 244 245 $this->assertStringContainsString( $date_part, $result ); 246 $this->assertStringContainsString( 'at', $result ); 247 $this->assertStringContainsString( $time_part, $result ); 248 } 212 249 }
Note: See TracChangeset
for help on using the changeset viewer.