dakboard / Cloud-Platform

Feature requests, enhancements and anything you'd like to see in DAKboard!
https://dakboard.com
168 stars 39 forks source link

Time Format for events on the Calendar #2167

Closed cocarrig closed 1 week ago

cocarrig commented 3 months ago

Description: For Calendar integrations, update formatting which for consistency with integrations use: Remove 'a' and 'p' and replace to 'am' and 'pm' respectfully. For 24 hour formatting, use HH:MM formatting (IE 14:00).

Discussed in https://github.com/dakboard/Cloud-Platform/discussions/1927

Originally posted by **rsalsbery** June 20, 2023 On the Big Monthly and Monthly calendar it has come to our attention that when an event starts at the top of the hour that the time stamp does not include the Minutes. See Below: image Customers have requested that we have the format be HH:MM when displaying this time to improve the aesthetic look of the calendar. I would recommend making this a selectable option as this was originally done to save space in the Calendar Day block.
rsalsbery commented 1 week ago

Duplicate case:

https://github.com/dakboard/Cloud-Platform/issues/2244

Dan-Peck commented 1 week ago

Development Update

While this is still under development, the following info may still change in the final release version, however, the expected HTML structure and CSS classes available in most calendar types will be as follows:

Classes:

Examples:

<span class="time-val isAM ">
  <span class="hour-val">12</span>
  <span class="minute-val">30</span>
  <span class="meridiem"></span>
</span>
<span class="time-val isAM  top-of-hour ">
  <span class="hour-val">4</span>
  <span class="minute-val">00</span>
  <span class="meridiem"></span>
</span>
<span class="time-val isPM  is24 ">
  <span class="hour-val">23</span>
  <span class="minute-val">30</span>
  <span class="meridiem"></span>
</span>

This release will change the standard appearance of times in the calendar. However, for those that wish to revert such changes back to what they are now will be able to use any/all of the following CSS to do so:

/** Hides :{minute} on top of the hour times **/
.time-val.top-of-hour .minute-val {
    display: none;
}

/** Change "am" to "a" **/
.time-val.isAM .meridiem:after {
    content: "a" !important;
}
/** Change "pm" to "p" **/
.time-val.isPM .meridiem:after {
    content: "p" !important;
}

/** Hides ":" separator **/
.time-val .minute-val:before {
    display: none;
}

Note that each calendar type may also make minor CSS adjustments to the formatting to suit the rendering for that type. But this should provide a great deal more flexibility and target-ability in styling calendar times.

Dan-Peck commented 1 week ago

Merged in @ 3aedce1 and added to the queue for upcoming release to the live site.