Skip to content

Conversation

@masteradhoc
Copy link
Contributor

Fixes #2890

Changes Proposed in this Pull Request

  • We should change the hardcoded dateformat for the Job Dashboard Shortcode. Currently it displays the date format hardcoded in the format 'M d, Y'. Now it will respect the settings set in WordPress.

Testing Instructions

  • open /job-dashboard/ page. without the fix it will be displayed like this
image

After the fix it will be displayed according to your settings, in my example "j. F Y".
image

Release Notes

  • fix hardcoded dashboard expiration date format

New or Updated Hooks and Templates

Deprecated Code

Screenshot / Video

Copy link
Contributor

@azaozz azaozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it is (almost) impossible to not have the date_format option set in WP, but just in case that happens somewhere this get_option() call will result in a trip to the DB (slow) and will return false which seems undesirable.

How about checking the option value before using it? Perhaps add something like:

$date_format = get_option( 'date_format' ) ?: 'M d, Y';

at the top then use $date_format in the HTML.

@masteradhoc
Copy link
Contributor Author

@azaozz definately a valid point! adjusted the code as per your suggestion and fixed the docblock as the title was also wrong there. hope thats fine inside the same PR.

@azaozz azaozz self-requested a review August 25, 2025 23:25
Copy link
Contributor

@azaozz azaozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@azaozz azaozz merged commit 88fd533 into Automattic:trunk Aug 25, 2025
19 of 21 checks passed
@masteradhoc masteradhoc deleted the patch-1 branch August 26, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard expiration date format

2 participants