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

WordPress Trac noreply at wordpress.org
Tue Mar 7 13:54:23 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 flixos90):

 Replying to [comment:17 swissspidy]:
 > > could we instead concatenate the date_format and time_format values
 with a space?
 >
 > Nope. String concatenation is always bad for i18n. Also, these strings
 already exists like that, see `WP_Locale::_strings_for_pot()`.

 Ah right. What I don't like about it though is that there would be no way
 for the user to modify the `datetime` format. It might be worth
 considering an option for that. On the other hand this might look over-
 complicated to the user ("I already added date and time formats").
 What about concatenating date and time format through another translation
 string `sprintf( _x( '%1$s %2$s', 'concatenation of date and time format'
 ), $date_format, $time_format )`? Then it would be manageable per locale.
 A locale that does not support concatenation of these values in any way
 could return an empty string, and in that case it would fall back to what
 we currently have there. We could even go as far as providing an option
 for users of a locale that doesn't support concatenation.

 Yes, I might be overthinking this, but I think we need a bit more
 flexibility here.

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


More information about the wp-trac mailing list