Skip to content

Commit 40fd0c6

Browse files
authored
Post Date block: Address feedback (#70982)
* Block bindings: Translate core/post-data source labels * Use epoch to compare dates * Add to backport changelog
1 parent 9b3d784 commit 40fd0c6

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

backport-changelog/6.9/9299.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
https://github.com/WordPress/wordpress-develop/pull/9299
22

3-
* https://github.com/WordPress/gutenberg/pull/70585
3+
* https://github.com/WordPress/gutenberg/pull/70585
4+
* https://github.com/WordPress/gutenberg/pull/70982

lib/compat/wordpress-6.9/post-data-block-bindings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function gutenberg_block_bindings_post_data_get_value( array $source_args, $bloc
4040

4141
if ( 'modified' === $source_args['key'] ) {
4242
// Only return the modified date if it is later than the publishing date.
43-
if ( get_the_modified_date( 'Ymdhi', $post_id ) > get_the_date( 'Ymdhi', $post_id ) ) {
43+
if ( get_the_modified_date( 'U', $post_id ) > get_the_date( 'U', $post_id ) ) {
4444
return esc_attr( get_the_modified_date( 'c', $post_id ) );
4545
} else {
4646
return '';

packages/editor/src/bindings/post-data.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* WordPress dependencies
33
*/
4+
import { __ } from '@wordpress/i18n';
45
import { store as coreDataStore } from '@wordpress/core-data';
56

67
/**
@@ -41,12 +42,12 @@ function getPostDataFields( select, context ) {
4142
);
4243
dataFields = {
4344
date: {
44-
label: 'Post Date',
45+
label: __( 'Post Date' ),
4546
value: entityDataValues?.date,
4647
type: 'string',
4748
},
4849
modified: {
49-
label: 'Post Modified Date',
50+
label: __( 'Post Modified Date' ),
5051
value: entityDataValues?.modified,
5152
type: 'string',
5253
},

0 commit comments

Comments
 (0)