Skip to content

Commit

Permalink
fix: localize date formats and notice text
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Jun 25, 2020
1 parent 188908e commit 0cb82f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/class-newspack-newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public static function display_post_states( $post_states, $post ) {
$post_states[ $post_status->name ] = sprintf( __( 'Sent %1$s ago', 'newspack-newsletters' ), $sent_date );
} else {
/* translators: Absolute time stamp of sent/published date */
$post_states[ $post_status->name ] = sprintf( __( 'Sent %1$s', 'newspack-newsletters' ), get_the_time( 'Y/m/d', $post ) );
$post_states[ $post_status->name ] = sprintf( __( 'Sent %1$s', 'newspack-newsletters' ), get_the_time( get_option( 'date_format' ), $post ) );
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/newsletter-editor/editor/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { withDispatch, withSelect } from '@wordpress/data';
import { createPortal, useEffect, useState } from '@wordpress/element';
Expand Down Expand Up @@ -87,9 +88,9 @@ const Editor = compose( [

useEffect(() => {
if ( 'publish' === props.status ) {
const dateTime = props.sentDate ? ' on ' + new Date( props.sentDate ).toLocaleString() : '';
const dateTime = props.sentDate ? new Date( props.sentDate ).toLocaleString() : '';
// Show an editor notice if the newsletter has been sent.
props.createNotice( 'success', `Campaign sent${ dateTime }.`, {
props.createNotice( 'success', __( 'Campaign sent on ', 'newspack-newsletters' ) + dateTime, {
isDismissible: false,
} );
}
Expand Down

0 comments on commit 0cb82f1

Please sign in to comment.