From: Bartosz DziewoƄski Date: Sat, 25 Jul 2015 12:07:39 +0000 (+0200) Subject: Moment.js: Use DMY date format for English X-Git-Tag: 1.31.0-rc.0~10629 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=c7f28b7fb653efeb702864b36cce978e066874cc;p=lhc%2Fweb%2Fwiklou.git Moment.js: Use DMY date format for English In accordance with MediaWiki's date formatting routines. For now, we continue not handling configuration options or user preferences in this code, although might be a good idea at some point. I prefer to keep this patch as simple as possible. Change-Id: I3f490e4bf6b573b5797e00316ec1e648f611765e --- diff --git a/resources/Resources.php b/resources/Resources.php index c54a120345..fb0971e49a 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -733,7 +733,10 @@ return array( /* Moment.js */ 'moment' => array( - 'scripts' => 'resources/lib/moment/moment.js', + 'scripts' => array( + 'resources/lib/moment/moment.js', + 'resources/src/moment-local-dmy.js', + ), 'languageScripts' => array( 'af' => 'resources/lib/moment/locale/af.js', 'ar' => 'resources/lib/moment/locale/ar.js', diff --git a/resources/src/moment-local-dmy.js b/resources/src/moment-local-dmy.js new file mode 100644 index 0000000000..c67b93e976 --- /dev/null +++ b/resources/src/moment-local-dmy.js @@ -0,0 +1,16 @@ +// Use DMY date format for Moment.js, in accordance with MediaWiki's date formatting routines. +// This affects English only (and languages without localisations, that fall back to English). +// http://momentjs.com/docs/#/customization/long-date-formats/ +/*global moment */ +moment.locale( 'en', { + longDateFormat: { + // Unchanged, but have to be repeated here: + LT: 'h:mm A', + LTS: 'h:mm:ss A', + // Customized: + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY LT', + LLLL: 'dddd, D MMMM YYYY LT' + } +} );