Repository navigation
feat(calendar): add dateFormatToday option - #4293
Closed
ms-zone-41 wants to merge 1 commit into
Closed
ms-zone-41 wants to merge 1 commit into
ms-zone-41 wants to merge 1 commit into
Conversation
With timeFormat "absolute" every event uses dateFormat, so events of today show the full date as well (e.g. "Tuesday 01.01. 09:00"). The new dateFormatToday option allows a shorter format for timed events that start today, e.g. "HH:mm". Full day events are not affected and an empty value (default) keeps the current behaviour. When showEnd is used, the start time is only added if dateFormatToday does not already contain a time.
Author
|
sorry, this PR was created too early |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Draft – please do not review yet. I am still doing my own final review of this change. I will mark this PR as ready for review when it is done.
With
timeFormat: "absolute", every event usesdateFormat. A format that works well for upcoming days (e.g.dddd DD.MM. HH:mm) is unnecessarily long for today's events, where the time is enough.showTimeTodaydoes not help here, because it only affects relative times.This PR adds a
dateFormatTodayoption for timed events that start today.Related issue
No related issue.
Changes
dateFormatToday(default"", which keeps the current behaviour). If set, it is used instead ofdateFormatfor timed events that start today in the absolute time format.showEnd, the start time is only added ifdateFormatTodaydoes not already contain a time (same check as fordateFormat).dateFormatIncludesTime()now takes the format to check as an optional parameter.buildAbsoluteTimeText(). Three of them fail without the change.Example:
dateFormatToday: "HH:mm"I will open a PR for the documentation (
modules/calendar.md) as soon as this one looks fine to you.Testing
npx vitest run tests/unit/modules/default/calendar(78 tests pass)node --run test:unit(497 tests pass)node --run test:lintandnode --run test:spellingfor the changed filesI used an AI coding assistant to help prepare this change. I reviewed and tested it myself.