Make dates in newsletter listings and help consistent
[MAILPOET-3441]
This commit is contained in:
@@ -1,8 +1,14 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
|
import parseDate from 'date-fns/parse';
|
||||||
|
|
||||||
const TasksListDataRow = (props) => (
|
const TasksListDataRow = (props) => {
|
||||||
|
let scheduled = props.task.scheduled_at;
|
||||||
|
if (scheduled) {
|
||||||
|
scheduled = parseDate(scheduled, 'yyyy-MM-dd HH:mm:ss', new Date());
|
||||||
|
}
|
||||||
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td className="column column-primary">
|
<td className="column column-primary">
|
||||||
{props.task.id}
|
{props.task.id}
|
||||||
@@ -28,7 +34,7 @@ const TasksListDataRow = (props) => (
|
|||||||
</td>
|
</td>
|
||||||
{props.show_scheduled_at ? (
|
{props.show_scheduled_at ? (
|
||||||
<td className="column-date">
|
<td className="column-date">
|
||||||
<abbr>{ MailPoet.Date.format(props.task.scheduled_at * 1000) }</abbr>
|
<abbr>{`${MailPoet.Date.short(scheduled)} ${MailPoet.Date.time(scheduled)}`}</abbr>
|
||||||
</td>
|
</td>
|
||||||
) : null}
|
) : null}
|
||||||
<td className="column-date">
|
<td className="column-date">
|
||||||
@@ -36,6 +42,7 @@ const TasksListDataRow = (props) => (
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
TasksListDataRow.propTypes = {
|
TasksListDataRow.propTypes = {
|
||||||
show_scheduled_at: PropTypes.bool,
|
show_scheduled_at: PropTypes.bool,
|
||||||
|
@@ -83,7 +83,7 @@ class State {
|
|||||||
'type' => $task->type,
|
'type' => $task->type,
|
||||||
'priority' => (int)$task->priority,
|
'priority' => (int)$task->priority,
|
||||||
'updated_at' => Carbon::createFromTimeString((string)$task->updatedAt)->timestamp,
|
'updated_at' => Carbon::createFromTimeString((string)$task->updatedAt)->timestamp,
|
||||||
'scheduled_at' => $task->scheduledAt ? Carbon::createFromTimeString($task->scheduledAt)->timestamp : null,
|
'scheduled_at' => $task->scheduledAt ? $task->scheduledAt : null,
|
||||||
'status' => $task->status,
|
'status' => $task->status,
|
||||||
'newsletter' => (($queue instanceof SendingQueue) && ($newsletter instanceof Newsletter)) ? [
|
'newsletter' => (($queue instanceof SendingQueue) && ($newsletter instanceof Newsletter)) ? [
|
||||||
'newsletter_id' => (int)$queue->newsletterId,
|
'newsletter_id' => (int)$queue->newsletterId,
|
||||||
|
Reference in New Issue
Block a user