Skip to content
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

Change behavior of date formatters #15

Merged
merged 3 commits into from Sep 6, 2022

Conversation

michael-rubel
Copy link
Owner

About

When we're working with date/datetime formatters, we need to make sure the date is not null. Otherwise, the format helper returns the current date. It is considered wrong behavior because most times current date is unexpected by the developer.

This PR changes the date formatters, so all null and empty values are now handled by returning null by the format helper.

Before:

! empty($datetime) ? format('date', $datetime) : __('No data')

After:

format('date', $datetime) ?? __('No data')

This change is breaking, so it'll be published at the v5 of the package.

@michael-rubel michael-rubel added the enhancement New feature or request label Sep 6, 2022
@michael-rubel michael-rubel self-assigned this Sep 6, 2022
@michael-rubel michael-rubel merged commit 977b981 into main Sep 6, 2022
@michael-rubel michael-rubel deleted the 5.x/date-formatters-new-behavior branch September 6, 2022 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant