• Resolved tera06z

    (@tera06z)


    I’m not an English speaker, so please forgive me if there are some improper parts.

    The time zone is used at’+9:00′.
    When the current time (WP server) time is from 0:00 to 9:00,’Minimum Date’ is not processed correctly.

    Example)
    timezone ‘+9:00’
    Current date: 2021-01-25 Hours 0:00-9:00
    ‘Minimum Date’ setting: “+5 days”
    Date picker UI 2021-01-29 However, after 9:00, it will be 2021-01-30.

    In Minimum Date and Maximum Date, the time zone is not processed properly when the format is relative.

    https://github.com/carmoreira/date-time-picker-field/blob/master/includes/DateTimePicker.php
    public function set_rules()
    143行目
    $temp_date = strtotime( $opts['max_date'] );

    Timezone cannot be processed with strtotime.
    I want you to replace it with the one that uses the time zone of DateTime or date_create ().

    
    			/*2021.01 ADD get $tzone*/
    			$tzone              = get_option( 'timezone_string' );
    			if ( isset( $opts['datepicker'] ) && 1 === intval( $opts['datepicker'] ) ) {
    				$format       .= $opts['dateformat'];
    				$clean_format .= $this->format( $opts['dateformat'] );
    
    				// max date.
    				if ( isset( $opts['max_date'] ) && $opts['max_date'] !== '' ) {
    					/*2021.01 Edit set $tzone
    					$temp_date = strtotime( $opts['max_date'] );*/
    					$temp_date = date_create($opts['max_date'], new DateTimeZone( $tzone ) );
    					if ( $temp_date ) {
    						//$opts['max_date'] = date( $clean_format, $temp_date );
    						$opts['max_date'] = $temp_date->format($clean_format);
    						//$opts['max_year'] = date( 'Y', $temp_date );
    						$opts['max_year'] = $temp_date->format('Y');
    					}
    				}
    
    				// min date.
    				if ( isset( $opts['min_date'] ) && $opts['min_date'] !== '' ) {
    					/*2021.01 Edit set $tzone
    					$temp_date = strtotime( $opts['min_date'] );*/
    					$temp_date = date_create($opts['min_date'], new DateTimeZone( $tzone ) );
    					
    					if ( $temp_date ) {
    						//$opts['min_date'] = date( $clean_format, $temp_date );
    						$opts['min_date'] = $temp_date->format($clean_format);
    						//$opts['min_year'] = date( 'Y', $temp_date );
    						$opts['min_year'] = $temp_date->format('Y');
    					} else {
    						$opts['min_date'] = false;
    					}
    				}
    			}
    
Viewing 1 replies (of 1 total)
  • Carlos Moreira

    (@carlosmoreirapt)

    Hi! Sorry for the late follow up.

    The strtotime does take into consideration the current timezone selected in your WP settings, so the problem might be somewhere else. There could be something modifying the PHP timezone for example. Do you have any other plugins that could modify timezone settings? Events plugins or similar?

    If I’m not mistaken, you’re also a PRO user, correct? If the problem persists in the PRO version, message us here: https://www.inputwp.com/support/

    There should be an update soon where some offset related issues were solved. It might also have an impact on this. If the problem persists after the next update let us know.

    Greetings, Carlos

Viewing 1 replies (of 1 total)
  • The topic ‘min/max timezone not work’ is closed to new replies.