Change notification newsletter time to be displayed in WP format

This commit is contained in:
Tautvidas Sipavičius
2016-06-14 16:28:06 +03:00
parent 2927875e16
commit ca9b1e25a7
4 changed files with 13 additions and 7 deletions

View File

@@ -43,8 +43,9 @@ define('date',
options = options || {};
this.init(options);
return Moment(date, this.convertFormat(options.parseFormat))
.format(this.convertFormat(this.options.format));
var date = Moment(date, this.convertFormat(options.parseFormat));
if (options.offset === 0) date = date.utc();
return date.format(this.convertFormat(this.options.format));
},
toDate: function(date, options) {
options = options || {};

View File

@@ -1,6 +1,8 @@
import _ from 'underscore'
import MailPoet from 'mailpoet'
const timeFormat = window.mailpoet_time_format || 'H:i';
// welcome emails
const _timeDelayValues = {
'immediate': MailPoet.I18n.t('delayImmediately'),
@@ -28,7 +30,7 @@ const _timeOfDayValues = _.object(_.map(
}), function(seconds) {
let date = new Date(null);
date.setSeconds(seconds);
const timeLabel = date.toISOString().substr(11, 5);
const timeLabel = MailPoet.Date.format(date, { format: timeFormat, offset: 0 });
return [seconds, timeLabel];
})
);
@@ -77,4 +79,4 @@ export { _intervalValues as intervalValues };
export { _timeOfDayValues as timeOfDayValues };
export { _weekDayValues as weekDayValues };
export { _monthDayValues as monthDayValues };
export { _nthWeekDayValues as nthWeekDayValues };
export { _nthWeekDayValues as nthWeekDayValues };

View File

@@ -141,4 +141,4 @@ const NotificationScheduling = React.createClass({
}
});
module.exports = NotificationScheduling;
module.exports = NotificationScheduling;

View File

@@ -38,6 +38,11 @@ jQuery('.toplevel_page_mailpoet.menu-top-last')
<% block after_css %><% endblock %>
<script type="text/javascript">
var mailpoet_date_format = "<%= wp_datetime_format() %>";
var mailpoet_time_format = "<%= wp_time_format() %>";
</script>
<!-- javascripts -->
<%= javascript(
'vendor.js',
@@ -51,8 +56,6 @@ jQuery('.toplevel_page_mailpoet.menu-top-last')
)%>
<script type="text/javascript">
var mailpoet_date_format = "<%= wp_datetime_format() %>";
if(window['HS'] !== undefined) {
HS.beacon.config({
icon: 'message',