Merge pull request #28322 from aheckler/patch-1
Return default date and time formats if options are empty
This commit is contained in:
commit
36108a2c83
|
@ -638,7 +638,12 @@ function wc_let_to_num( $size ) {
|
|||
* @return string
|
||||
*/
|
||||
function wc_date_format() {
|
||||
return apply_filters( 'woocommerce_date_format', get_option( 'date_format' ) );
|
||||
$date_format = get_option( 'date_format' );
|
||||
if ( empty( $date_format ) ) {
|
||||
// Return default date format if the option is empty.
|
||||
$date_format = 'F j, Y';
|
||||
}
|
||||
return apply_filters( 'woocommerce_date_format', $date_format );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -647,7 +652,12 @@ function wc_date_format() {
|
|||
* @return string
|
||||
*/
|
||||
function wc_time_format() {
|
||||
return apply_filters( 'woocommerce_time_format', get_option( 'time_format' ) );
|
||||
$time_format = get_option( 'time_format' );
|
||||
if ( empty( $time_format ) ) {
|
||||
// Return default time format if the option is empty.
|
||||
$time_format = 'g:i a';
|
||||
}
|
||||
return apply_filters( 'woocommerce_time_format', $time_format );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue