Use global date format string for date in newsletter scheduler

I found that we already have a global variable mailpoet_date_format defined in layout.html
so I removed duplicate mailpoet_date_display_format and used the global one directly.

The global one is set correctly using wp_date_format()|escape('js')
instead of incorrect wp_datetime_format()|escape('js')

[MAILPOET-5472]
This commit is contained in:
Rostislav Wolny
2023-07-20 15:16:55 +02:00
committed by Aschepikov
parent 4a02d5cfaf
commit fcdbb65091
3 changed files with 1 additions and 3 deletions

View File

@ -147,7 +147,6 @@ interface Window {
mailpoet_current_date?: string;
mailpoet_tomorrow_date?: string;
mailpoet_schedule_time_of_day?: string;
mailpoet_date_display_format?: string;
mailpoet_date_storage_format?: string;
mailpoet_current_date_time?: string;
mailpoet_urls: Record<string, string>;

View File

@ -15,7 +15,7 @@ import { Field } from '../../form/types';
const currentTime = window.mailpoet_current_time || '00:00';
const tomorrowDateTime = `${window.mailpoet_tomorrow_date} 08:00:00`;
const timeOfDayItems = window.mailpoet_schedule_time_of_day;
const dateDisplayFormat = window.mailpoet_date_display_format;
const dateDisplayFormat = window.mailpoet_date_format;
const dateStorageFormat = window.mailpoet_date_storage_format;
type StandardSchedulingProps = {

View File

@ -19,7 +19,6 @@
var mailpoet_current_time = <%= json_encode(current_time) %>;
var mailpoet_current_date_time = <%= json_encode(current_date_time) %>;
var mailpoet_schedule_time_of_day = <%= json_encode(schedule_time_of_day) %>;
var mailpoet_date_display_format = "<%= wp_datetime_format()|escape('js') %>";
var mailpoet_date_storage_format = "Y-m-d";
var mailpoet_product_categories = <%= json_encode(product_categories) %>;
var mailpoet_products = <%= json_encode(products) %>;