@@ -113,20 +113,20 @@ public function column_expires( $item ) {
113113 if ( empty ( $ item ['expires ' ] ) ) {
114114 echo '— ' ;
115115 } else {
116- $ date = date_i18n ( __ ( 'F j, Y ' ), $ item ['expires ' ] );
116+ $ date = wp_date ( get_option ( 'date_format ' ) . ' ' . get_option ( ' time_format ' ), $ item ['expires ' ] );
117117 if ( time () > $ item ['expires ' ] ) {
118118 printf (
119119 '%s ' ,
120- /* translators: %s: Expiration date for the Application Password. */
121- sprintf ( __ ( 'Expired on %s ' ), $ date )
120+ /* translators: %s: Expiration date and time for the Application Password. */
121+ sprintf ( esc_html__ ( 'Expired on %s ' ), esc_html ( $ date ) )
122122 );
123123 } else {
124- echo $ date ;
124+ echo esc_html ( $ date ) ;
125125 }
126126 }
127127 printf (
128128 '<br><button type="button" class="button-link edit-expires" aria-label="%s">%s</button> ' ,
129- esc_attr__ ( 'Edit Application Password Expiration Date ' ),
129+ esc_attr__ ( 'Edit Expiration Date and Time ' ),
130130 esc_html__ ( 'Edit Expiry ' )
131131 );
132132 }
@@ -208,7 +208,8 @@ protected function display_tablenav( $which ) {
208208 * @param array $item The current item.
209209 */
210210 public function single_row ( $ item ) {
211- echo '<tr data-uuid=" ' . esc_attr ( $ item ['uuid ' ] ) . '"> ' ;
211+ $ expires = ! empty ( $ item ['expires ' ] ) ? gmdate ( 'Y-m-d\TH:i:s ' , $ item ['expires ' ] ) : '' ;
212+ echo '<tr data-uuid=" ' . esc_attr ( $ item ['uuid ' ] ) . '" data-expires=" ' . esc_attr ( $ expires ) . '"> ' ;
212213 $ this ->single_row_columns ( $ item );
213214 echo '</tr> ' ;
214215 }
@@ -232,7 +233,7 @@ protected function get_default_primary_column_name() {
232233 public function print_js_template_row () {
233234 list ( $ columns , $ hidden , , $ primary ) = $ this ->get_column_info ();
234235
235- echo '<tr data-uuid="{{ data.uuid }}"> ' ;
236+ echo '<tr data-uuid="{{ data.uuid }}" data-expires="{{ data.expires || \'\' }}" > ' ;
236237
237238 foreach ( $ columns as $ column_name => $ display_name ) {
238239 $ is_primary = $ primary === $ column_name ;
@@ -270,11 +271,12 @@ public function print_js_template_row() {
270271 case 'expires ' :
271272 ?>
272273 <# if ( data.expires ) { #>
273- <# var isExpired = new Date().getTime() > new Date( data.expires ).getTime(); #>
274- <# var formattedDate = wp.date.dateI18n( <?php echo wp_json_encode ( __ ( 'F j, Y ' ) ); ?> , data.expires ); #>
274+ <# var expiresDate = new Date( data.expires + 'Z' ); #>
275+ <# var isExpired = new Date().getTime() > expiresDate.getTime(); #>
276+ <# var formattedDate = wp.date.dateI18n( <?php echo wp_json_encode ( get_option ( 'date_format ' ) . ' ' . get_option ( 'time_format ' ) ); ?> , expiresDate ); #>
275277 <# if ( isExpired ) { #>
276278 <?php
277- /* translators: %s: Expiration date for the Application Password. */
279+ /* translators: %s: Expiration date and time for the Application Password. */
278280 printf ( esc_html__ ( 'Expired on %s ' ), '{{ formattedDate }} ' );
279281 ?>
280282 <# } else { #>
@@ -283,7 +285,7 @@ public function print_js_template_row() {
283285 <# } else { #>
284286 —
285287 <# } #>
286- <br><button type="button" class="button-link edit-expires" aria-label="<?php esc_attr_e ( 'Edit Expiration Date ' ); ?> "><?php esc_html_e ( 'Edit Expiry ' ); ?> </button>
288+ <br><button type="button" class="button-link edit-expires" aria-label="<?php esc_attr_e ( 'Edit Expiration Date and Time ' ); ?> "><?php esc_html_e ( 'Edit Expiry ' ); ?> </button>
287289 <?php
288290 break ;
289291 case 'revoke ' :
0 commit comments