Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2695,6 +2695,11 @@ public static function get_formatted_time( $date, $date_format = '', $time_forma
return $formatted;
}

/**
* @param string $time_format
* @param string $date
* @return string
*/
private static function add_time_to_date( $time_format, $date ) {
if ( empty( $time_format ) ) {
$time_format = get_option( 'time_format' );
Expand Down
18 changes: 14 additions & 4 deletions classes/views/frm-entries/_sidebar-shared-pub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@

if ( ! isset( $entry ) ) {
$entry = $record;
} ?>
}
?>

<div class="misc-pub-section">
<?php FrmAppHelper::icon_by_class( 'frm_icon_font frm_calendar_icon', array( 'aria-hidden' => 'true' ) ); ?>
<span id="timestamp">
<?php
$date_format = __( 'M j, Y @ G:i', 'formidable' );

$date_format = get_option( 'date_format' );
if ( $date_format ) {
// Use short months since the sidebar space is limited.
$date_format = str_replace( 'F', 'M', $date_format );
} else {
// Fallback if there is no option in the database.
$date_format = __( 'M j, Y', 'formidable' );
}

printf(
/* translators: %1$s: Entry status %2$s: The date */
esc_html__( '%1$s: %2$s', 'formidable' ),
esc_html( FrmEntriesHelper::get_entry_status_label( $entry->is_draft ) ),
'<b>' . esc_html( FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) ) . '</b>'
'<b>' . esc_html( FrmAppHelper::get_formatted_time( $entry->created_at, $date_format ) ) . '</b>'
);
?>
</span>
Expand All @@ -30,7 +40,7 @@
printf(
/* translators: %1$s: The date */
esc_html__( 'Updated: %1$s', 'formidable' ),
'<b>' . esc_html( FrmAppHelper::get_localized_date( $date_format, $entry->updated_at ) ) . '</b>'
'<b>' . esc_html( FrmAppHelper::get_formatted_time( $entry->updated_at, $date_format ) ) . '</b>'
);
?>
</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/Entries/EntriesPageDataValidations.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe("Entries submitted from a form", () => {
cy.get(':nth-child(2) > h3').should("contain", "Entry Details");
cy.get('#timestamp')
.invoke('text')
.should('match', /Submitted: [A-Za-z]{3} \d{1,2}, \d{4} @ \d{1,2}:\d{2}/);
.should('match', /Submitted: [A-Za-z]{3} \d{1,2}, \d{4} at \d{1,2}:\d{2} (am|pm)/);
cy.get(':nth-child(2) > .inside > :nth-child(2)').should("contain", "Entry ID:");
cy.log('Extract and trim the value after "Entry Key:')
cy.get(':nth-child(2) > .inside > :nth-child(3)')
Expand Down