-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Abbreviate post schedule date when possible #41738
Conversation
Use abbreviations such as 'Today' and 'Tomorrow' in the post schedule label when it makes sense to do so.
Not sure why the text in the post schedule button wraps to a new line on hover. Will investigate tomorrow. |
Size Change: +827 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
Except for the thing that you mentioned (could it be related to the tooltip?), this works fine for me.
This is great, I'll add the last exceptions to the Figma file. |
Cool improvement! |
OK, I've added a hacky fix for this along with an explanatory comment. When #41268 is merged we should be able to remove the hack. |
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.
Nice work @noisysocks, this is testing well (and I like the small addition of the non-breaking space between the minutes and AM / PM 👍)
✅ With a different user timezone to site timezone, the full date is displayed consistently
✅ With a matching timezone, Today behaves correctly
✅ With a matching timezone, Tomorrow behaves correctly
✅ With a matching timezone, the current year is hidden if the publish date is this year
✅ With a matching timezone, the current year is displayed if the publish date is next year
✅ Tooltip popover styling hack works in the interim 👍
LGTM! ✨
Thanks @andrewserong and @javierarce! |
What?
Use abbreviations such as 'Today' and 'Tomorrow' in the post schedule label when it makes sense to do so.
Why?
Part of #39082. Specifically, this page in the Figma:
How?
I added a bunch of if statements to
PostScheduleLabel
! 😀I followed what's outlined in the design above pretty closely, except for:
If the user's timezone does not match the site's timezone, then we always show the full date. This avoids ambiguity around what e.g. 'tomorrow' means when the timezones are different.
If the site's timezone has a name (e.g. 'AEST') then we show that instead of the UTC offset (e.g. 'UTC+10'). This is what we do in the date picker.
All of the date formats are passed through
_x
so that they can be localised.I switched to using
wp.date.dateI18n
(instead ofwp.date.format
) so that any words in the dates (e.g. 'Monday') can be localised.Testing Instructions
Screenshots or screencast
Kapture.2022-06-15.at.17.07.10.mp4