Skip to content

Commit 8a2ae6d

Browse files
committed
gpld-limit-year-dropdown-options.php: Added snippet to limit date dropdown year options based on configured min/max.
1 parent 7e88bf8 commit 8a2ae6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gp-limit-dates/gpld-limit-year-dropdown-options.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ protected function filter_year( $type, $default_year, $form, $field ) {
4040
return $default_year;
4141
}
4242

43-
$options = gp_limit_dates()->get_limit_dates_field_options( $field );
43+
$options = gp_limit_dates()->get_limit_dates_field_options( $field );
4444
$date_key = $type . 'Date';
45-
$mod_key = $type . 'DateMod';
45+
$mod_key = $type . 'DateMod';
4646

4747
if ( empty( $options[ $date_key ] ) ) {
4848
return $default_year;
4949
}
5050

5151
$date_value = $options[ $date_key ];
52-
$modifier = rgar( $options, $mod_key );
52+
$modifier = rgar( $options, $mod_key );
5353

5454
if ( $date_value == '{today}' ) {
5555
$timestamp = strtotime( 'today midnight' );
@@ -64,7 +64,7 @@ protected function filter_year( $type, $default_year, $form, $field ) {
6464
}
6565

6666
if ( $timestamp ) {
67-
$calculated_year = date( 'Y', $timestamp );
67+
$calculated_year = gmdate( 'Y', $timestamp );
6868
return $type === 'min' ? max( $calculated_year, $default_year ) : min( $calculated_year, $default_year );
6969
}
7070

0 commit comments

Comments
 (0)