stephenharris/Event-Organiser

Time formatting fun

stephenharris opened this issue · 3 comments

There isn't a standard of default time format in EO. While all date/time formatting on the front-end is changeable - there should perhaps be a 'unified' default value. For example

  • Page templates use 'j F Y g:ia'
  • Event admin page & event list Shortcodes/widgets use the WordPress settings
  • fullCalendar uses the 24 hour time by default. Can be edited with 'timeformat' attribute
  • admin Calendar can be switched between 24/12 hour via screen options on that page

(See this thread).

For admin-side, determining whether 24 or 12 hour time should be used should be taken from the time setting option.

Possible problems:

  • Time setting is for display, so it may be 12 hour, while admins may prefer entering in 24 hour.
  • Some languages don't have 'am' or 'pm' - they use 24 hour.

Would require a function which takes a string (time format) and outputs whether its using 12 or 24 hour time.

An option could be added to the settings page to change this 'guess' manually - but do we really want another option...?

Pull requests, welcome!

Todo

  • Create function to check if blog is using 24/12 hour time: eventorganiser_blog_is_24()
  • Default templates should use get_option('time_format')
  • Default time format for agenda should be based on eventorganiser_blog_is_24()
  • Default calendar time format should be based on get_option('time_format')
  • Admin calendar 12/24 hour screen option should be based on eventorganiser_blog_is_24() (and possibly removed)
  • Default formats of event list shortcode/widgets should be get_option('time_format')
  • Maybe: Allow input of time formats in 12/24 format.

PLEASE give 'backwards' Americans a universal option to change the time format, like you do the date format on the settings page. Would be ever SO appreciated. I want to use this with a client's site, but that 'Add Event' page with 24-hour format input is keeping me from using it. .. Unless there's a way to change it that I haven't found. THanks.

@bburtraw Currently the time option on the add event page is 24-hour only. I hope to update this soon so as to make an educated guess as to whether 12 or 24 hour time should be used.

Allow 12 or 24 hour time format input: a1ff8de