Our organization's style guide specifies a date-time in this format: Dec. 31 08:45 a.m.. Our site runs Drupal, which is a PHP-based CMS. Its field formatting templates allow for date-formatting strings specified in the encoding which is defined in HPHP's date() function. It only offers a, which gives pm, and A, which gives me PM, but I don't see anything specifying one with periods.
Unfortunately, there is not an easy way to hook in to the platform to define a custom date format, so I figure the simplest way forward is to do a find-and-replace with javascript. What I want to do is replace instances in the format NN:NN am and NN:NN pm with NN:NN a.m., etc.
Regexes have never been my strong suit. I can match date time format well enough( [0-9][0-9]:[0-9][0-9] pm), but I don't know how to perform the proper replacement.
How can I replace am and pm with properly abbreviated version, when they follow a four-digit time format?
[0-9][0-9]:[0-9][0-9] pm. I don't know how to do the replace part.