File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -962,6 +962,18 @@ public function register_search_fields(Request $request)
962962 // Build this search URL
963963 $ search_URL = route (Setting::grab ('main_route ' ) . '.search ' );
964964 foreach ($ search_fields as $ field => $ value ){
965+ if (in_array ($ field , $ this ->a_search_fields_date )){
966+ $ carbon_instance = Carbon::createFromFormat (trans ('panichd::lang.datetime-format ' ), $ value );
967+ if ($ search_fields [$ field . '_type ' ] == 'exact_year ' ){
968+ // If a date field type is "exact_year", show only year in URL
969+ $ value = $ carbon_instance ->format ('Y ' );
970+
971+ }elseif ($ search_fields [$ field . '_type ' ] == 'exact_day ' ){
972+ // If a date field type is "exact_day", show only locale datetime string in URL
973+ $ value = $ carbon_instance ->format (trans ('panichd::lang.date-format ' ));
974+ }
975+
976+ }
965977 $ search_URL .= '/ ' . $ field . '/ ' . (is_array ($ value ) ? implode (', ' , $ value ) : $ value );
966978 }
967979
You can’t perform that action at this time.
0 commit comments