Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next payment date localization efforts #3195

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from
Draft
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
19 changes: 1 addition & 18 deletions classes/class-pmpro-subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,24 +781,7 @@ private function format_subscription_date( $date, $format = 'timestamp', $local_
$format = get_option( 'date_format' );
}

// Get date in WP local timezone.
if ( $local_time ) {
if( 'U' === $format ){
// When formatting using the epoch, the date must already consider the timezone offset.
// Then, first apply a simple format to add the timezone.
$date = get_date_from_gmt( $date );
}

return get_date_from_gmt( $date, $format );
}

// Allow timestamps.
if ( ! is_numeric( $date ) ) {
$date = strtotime( $date );
}

// Get date in GMT timezone.
return gmdate( $format, $date );
return wp_date( $format, strtotime( $date ), $local_time ? null : new DateTimezone( 'UTC' ) );
}

/**
Expand Down