Opened 4 weeks ago
Last modified 4 weeks ago
#63207 reopened defect (bug)
Docs: Enhance inline documentation for current_time, wp_date, and date_i18n functions/filters.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Date/Time | Keywords: | has-patch has-unit-tests |
Focuses: | docs | Cc: |
Description
- The
$gmt
argument in thecurrent_time
function accepts a boolean valuetrue|false
- The
$timestamp
and$timezone
arguments in thewp_date
function acceptnull
, but this is not documented inline. - The
date_i18n
filter documentation includes "Default false," but it seems unnecessary. Ref: https://tinyurl.com/236y7b5u
Change History (9)
This ticket was mentioned in PR #8625 on WordPress/wordpress-develop by @dilipbheda.
4 weeks ago
#1
#3
@
4 weeks ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
#4
follow-up:
↓ 7
@
4 weeks ago
- Resolution fixed deleted
- Status changed from closed to reopened
[60119] is more than just a docs change, and there are unit tests that pass a non-boolean value to this function (test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC()
, test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC()
, maybe others) that should be updated. Functionally it's fine because that parameter is really a boolean, but let's be careful about calling something a docs change when it's technically more than that.
#5
follow-up:
↓ 6
@
4 weeks ago
@johnbillion Thanks for pointing this out! I checked and found that the core also uses the 1|0
value in some places, so it's possible that other plugins/themes use it as well.
You can check this here: https://github.com/search?q=repo%3AWordPress%2Fwordpress-develop+current_time%28+%27mysql%27%2C+&type=code
From my perspective, we should revert the @param
type from bool
to int|bool
What do you think?
cc @SergeyBiryukov
#6
in reply to:
↑ 5
@
4 weeks ago
Replying to dilipbheda:
From my perspective, we should revert the
@param
type frombool
toint|bool
What do you think?
I think bool
is fine here, and is more consistent with the same parameter in date_i18n()
. Let's update the instances in core and unit tests to pass true
instead of 1
for consistency. It's OK if some plugins or themes would still pass 1
, as the function just checks for a truthy value.
#7
in reply to:
↑ 4
@
4 weeks ago
Replying to johnbillion:
Functionally it's fine because that parameter is really a boolean, but let's be careful about calling something a docs change when it's technically more than that.
Good point, thanks!
This ticket was mentioned in PR #8644 on WordPress/wordpress-develop by @dilipbheda.
4 weeks ago
#8
- Keywords has-unit-tests added
In 60119: