Respect WP's first day of week setting in schedule calendar

[MAILPOET-1995]
This commit is contained in:
Ján Mikláš
2019-04-23 14:16:28 +02:00
committed by M. Shull
parent 337e8d6165
commit 92aa16131c
3 changed files with 11 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ class DateText extends React.Component {
$element.datepicker(_.extend({
dateFormat: this.props.displayFormat,
firstDay: window.mailpoet_start_of_week,
isRTL: false,
onSelect: function onSelect(value) {
that.onChange({

View File

@@ -123,6 +123,11 @@ class Functions extends AbstractExtension {
array($this, 'isWoocommerceActive'),
array('is_safe' => array('all'))
),
new TwigFunction(
'wp_start_of_week',
array($this, 'getWPStartOfWeek'),
array('is_safe' => array('all'))
),
);
}
@@ -166,6 +171,10 @@ class Functions extends AbstractExtension {
return WPFunctions::get()->getOption('date_format') ?: 'F j, Y';
}
function getWPStartOfWeek() {
return WPFunctions::get()->getOption('start_of_week') ?: 0;
}
function getMailPoetVersion() {
return MAILPOET_VERSION;
}

View File

@@ -17,6 +17,7 @@
var mailpoet_server_time_zone = <%= json_encode(current_time_zone) %>;
var mailpoet_schedule_time_of_day = <%= json_encode(schedule_time_of_day) %>;
var mailpoet_date_display_format = "<%= wp_date_format() %>";
var mailpoet_start_of_week = "<%= wp_start_of_week() %>";
var mailpoet_site_url = "<%= site_url %>";
var mailpoet_date_storage_format = "Y-m-d";
var mailpoet_tracking_enabled = <%= json_encode(tracking_enabled) %>;