Replace times with words for noon, midnight; Add Sept. exception

Created on 13 May 2024, 6 months ago
Updated 30 May 2024, 6 months ago

Problem/Motivation

To fully confirm with the AP Stylebook, this module should alter the time output to replace "12:00pm" or "12pm" with "noon", and "12:00am" or "12am" with "midnight". Also, set an exception to abbreviate Sept. as originally cited in πŸ“Œ September is abbreviated as Sept. not Sep. Closed: duplicate .

Proposed resolution

Update the augmenter to provide this as an additional configuration option, on by default.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada mandclu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mandclu
  • Merge request !4First draft of word replace β†’ (Merged) created by mandclu
  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joewhitsitt Iowa

    It might also be advisable to replace "11:59pm" with midnight, but open to discussion on this idea.

    If you can point to a reference regarding this, I think this could be a opt-in option in addition.

  • πŸ‡¨πŸ‡¦Canada mandclu

    I don't have any indication that this is a genuine AP-approved recommendation. My mention of that was more because listing an event as 8pm to midnight will always show the date for the next day, where 11:59pm would. So in theory, this could allow for showing events that display as ending at midnight without showing an end date.

    A different resolution would be reviving an old Smart Date issue about adding a setting for a "next day" threshold. For example, if you set this as 3am then events that end before 3am wouldn't show a day for the end.

  • πŸ‡¨πŸ‡¦Canada mandclu

    Didn't mean to change the status

  • πŸ‡ΊπŸ‡ΈUnited States joewhitsitt Iowa

    Oh gosh. I don't know how you deal with all of this date stuff. Thank you for the example. Should the string matches account for 12:00:00 as well and if an 11:59 p.m. option is allowed any number of seconds between 11:59:00 p.m. and 12:00:00 a.m.? Does this get complicated enough that a stored timestamp should be evaluated against instead of the markup string?

  • πŸ‡¨πŸ‡¦Canada mandclu

    The more I think about it, the more it makes sense to handle the date rollover in the upstream Smart Date issue.

  • πŸ‡ΊπŸ‡ΈUnited States joewhitsitt Iowa

    Taking a look at this and don't have an idea yet, but with a format like M. j, Y the code str_replace([$month_full, $month_abbr . '.', $month_abbr]... is causing things like Marchch and Sept.t.

  • Status changed to Needs work 6 months ago
  • πŸ‡¨πŸ‡¦Canada mandclu

    Right, it ends up replacing twice if the period is present. It may be tricky to have it work both with and without the period in the pattern, but I'll give it a shot.

  • Status changed to Needs review 6 months ago
  • πŸ‡¨πŸ‡¦Canada mandclu

    This works for me.

  • Pipeline finished with Skipped
    6 months ago
    #174663
  • πŸ‡ΊπŸ‡ΈUnited States joewhitsitt Iowa

    Looks good. Thanks for the quick adjustments. If there is desire for the 11:59pm = midnight option, I suggest a follow up issue.

    // @todo worry about handling other languages?

    I think the primary focus of the AP Stylebook is English-language usage and style, but you can't quote me on that since I don't actually license a copy. Leaving in for now.

  • Status changed to Fixed 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States joewhitsitt Iowa
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024