Skip to content

Commit d23a527

Browse files
authored
gpnf-sort-nested-form-entries.php: Added support for sorting by Date fields.
1 parent 295a85a commit d23a527

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gp-nested-forms/gpnf-sort-nested-form-entries.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ public function sort_entries_php( $args ) {
6565
}
6666

6767
if ( $this->_is_date_field ) {
68-
$first = strtotime( $first );
69-
$second = strtotime( $second );
68+
$first_time = strtotime( $first );
69+
$second_time = strtotime( $second );
70+
71+
$first = ( $first_time !== false ) ? $first_time : 0;
72+
$second = ( $second_time !== false ) ? $second_time : 0;
7073
}
7174

7275
if ( $order === 'asc' ) {

0 commit comments

Comments
 (0)