Skip to content
Snippets Groups Projects
Commit 3a672c41 authored by Erick Hitter's avatar Erick Hitter
Browse files

Better handling of empty dates, showing an empty field rather than the...

Better handling of empty dates, showing an empty field rather than the Gregorian equivalent of the Unix epoch.
parent 72fc8396
Branches
No related tags found
No related merge requests found
...@@ -157,8 +157,11 @@ class ETH_Timeline { ...@@ -157,8 +157,11 @@ class ETH_Timeline {
* *
*/ */
public function meta_box_dates( $post ) { public function meta_box_dates( $post ) {
$start = (int) get_post_meta( $post->ID, $this->meta_start, true ); $start = get_post_meta( $post->ID, $this->meta_start, true );
$end = (int) get_post_meta( $post->ID, $this->meta_end, true ); $start = is_numeric( $start ) ? (int) $start : '';
$end = get_post_meta( $post->ID, $this->meta_end, true );
$end = is_numeric( $end ) ? (int) $end : '';
?> ?>
<p id="eth-timeline-startbox"> <p id="eth-timeline-startbox">
...@@ -188,7 +191,7 @@ class ETH_Timeline { ...@@ -188,7 +191,7 @@ class ETH_Timeline {
foreach ( $dates as $key => $date ) { foreach ( $dates as $key => $date ) {
// Timestamp comes from JS // Timestamp comes from JS
if ( empty( $date ) ) if ( empty( $date ) )
$timestamp = 0; $timestamp = false;
else else
$timestamp = strtotime( $date ); $timestamp = strtotime( $date );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment