From 59757e78e2ba8952e743e6b5764e7e69abe8e077 Mon Sep 17 00:00:00 2001 From: fumikito Date: Fri, 31 Jan 2025 16:28:24 +0900 Subject: [PATCH 1/2] Fix classic editor metabox. --- .wp-env.json | 3 ++- includes/meta-box.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.wp-env.json b/.wp-env.json index 58c10c6..7788f82 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -3,7 +3,8 @@ ".", "https://downloads.wordpress.org/plugin/classic-editor.latest-stable.zip", "https://downloads.wordpress.org/plugin/taro-ad-fields.latest-stable.zip", - "https://downloads.wordpress.org/plugin/query-monitor.latest-stable.zip" + "https://downloads.wordpress.org/plugin/query-monitor.latest-stable.zip", + "https://downloads.wordpress.org/plugin/localhost2host-docker-internal.latest-stable.zip" ], "themes": [ "https://downloads.wordpress.org/theme/twentytwenty.latest-stable.zip" diff --git a/includes/meta-box.php b/includes/meta-box.php index 313b673..06b45c0 100644 --- a/includes/meta-box.php +++ b/includes/meta-box.php @@ -16,8 +16,8 @@ wp_nonce_field( 'tscp_date', '_tscpnonce', false ); $date_time = get_post_meta( $post->ID, '_tscp_expires', true ); if ( ! $date_time ) { - $now = new DateTime(); - $now->add( new DateInterval( sprintf( 'P1MT%sH', get_option( 'gmt_offset' ) ) ) ); + $now = new DateTime( 'now', wp_timezone() ); + $now->add( new DateInterval( 'P1M' ) ); $one_month_later = $now->format( 'Y-m-d H:i:s' ); $date_time = apply_filters( 'tspc_default_expires', $one_month_later, $post ); } @@ -37,9 +37,9 @@ $year_input = sprintf( '', esc_attr( $year ) ); $month_input = ''; $day_input = sprintf( '', esc_attr( $day ) ); From 0206d7ce51a99921ce60c3b72252da0560870bb8 Mon Sep 17 00:00:00 2001 From: fumikito Date: Fri, 31 Jan 2025 16:29:58 +0900 Subject: [PATCH 2/2] Fix readme. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 09e433b..e3b9fff 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,10 @@ add_filter( 'tscp_cron_interval', function() { ## Changelog +### 1.2.6 + +* Fix month string error in Clasic editor's meta box. This happened on Any 31st day in a month. + ### 1.2.2 * Fix deploy script to avoid incorrect versioning.