-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix: support date formats with translated strings #4000 #4005
Conversation
to clone exiting input field to add datepicker to this element and old field will be used to store date in standard format `yy-mm-dd`
also add support for timestamp
to input field value if standard-date data attribute is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we're getting more complex for actually outputting the dates. Can this be simplified at all?
@@ -404,8 +404,8 @@ function give_form_search_query_filter( $wp ) { | |||
|
|||
$wp->query_vars['date_query'] = | |||
array( | |||
'after' => ! empty( $_GET['start-date'] ) ? give_get_formatted_date( $_GET['start-date'] ) : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the recommended usage of give_get_formatted_date()
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevinWalker This function does not work fine with translated localize date strings.
I updated the function description:
@@ -621,11 +621,21 @@ public function date_filter_pre() { | |||
$date_query = array(); | |||
|
|||
if ( ! empty ( $this->args['start_date'] ) ) { | |||
$date_query['after'] = give_get_formatted_date( $this->args['start_date'] ); | |||
$date_query['after'] = date( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots more code, can this be done in a dryer way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DevinWalker I did two tings here:
-
since
give_get_formatted_date
does not work well with translated localized date strings, so we start usingdate
fn to convert the date toMySQL
date format which is standard. -
Added support for the timestamp in
start_date
andend_date
query param.
* release/2.4.2: fix: process all possible export steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed code and video and it looks good. Lots more logic but dates get complex through formats.
Description
This pr will resolve #4000
How Has This Been Tested?
https://www.useloom.com/share/21c6e1cbafe747a7afb8ca772c2f62a7
Screenshots (jpeg or gifs if applicable):
Checklist: