[wp-trac] [WordPress Trac] #39222: Add JavaScript date helpers

WordPress Trac noreply at wordpress.org
Wed Apr 12 03:31:30 UTC 2017


#39222: Add JavaScript date helpers
---------------------------------------------------+-----------------------
 Reporter:  rmccue                                 |       Owner:  rmccue
     Type:  feature request                        |      Status:  assigned
 Priority:  normal                                 |   Milestone:  4.8
Component:  Date/Time                              |     Version:  4.7
 Severity:  normal                                 |  Resolution:
 Keywords:  has-patch needs-unit-tests needs-docs  |     Focuses:  rest-api
---------------------------------------------------+-----------------------

Comment (by rmccue):

 Replying to [comment:15 flixos90]:
 > Something minor to consider: Instead of hard-coding `__( 'F j, Y g:i a'
 )` for the datetime setting, could we instead concatenate the
 `date_format` and `time_format` values with a space?

 This is one that's already hardcoded, IIRC, although looking at it now,
 appears the only place this is used is in the (deprecated) Links manager
 (`links_updated_date_format` option).

 Would potentially make sense for this to be a wider setting in any case.
 There's some existing hardcoded date formats that could potentially be
 replaced with this (such as the date format in the posts list table).

 FWIW, the comments list table currently concatenates date formats, and
 isn't configurable:
 {{{
 $submitted = sprintf( __( '%1$s at %2$s' ),
         /* translators: comment date format. See
 https://secure.php.net/date */
         get_comment_date( __( 'Y/m/d' ), $comment ),
         get_comment_date( __( 'g:i a' ), $comment )
 );
 }}}

 > Also, what is `formats.timezone` used for (I couldn't see it anywhere in
 the code, why is that necessary)?

 It's used for the timezone selector's "Local time is ..." preview; I
 originally JS-ified that as well, but dropped it from the patch since it
 became a bit too complex. Can remove the format (the current one is
 translated at the top of `options-general.php`).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39222#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list