Adamw has submitted this change and it was merged.

Change subject: Altering CentralNotice UI Date Format
......................................................................


Altering CentralNotice UI Date Format

Start/End dates on the campaign list page sucked! They still
do, but hopefully this is less suck.

Change-Id: I18854e8734f91efa59bb23a8191316a23929fc3e
---
M CentralNotice.i18n.php
M modules/ext.centralNotice.interface/centralnotice.css
M special/SpecialCentralNotice.php
3 files changed, 11 insertions(+), 18 deletions(-)

Approvals:
  Adamw: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CentralNotice.i18n.php b/CentralNotice.i18n.php
index a24e142..b44287f 100644
--- a/CentralNotice.i18n.php
+++ b/CentralNotice.i18n.php
@@ -22,7 +22,7 @@
 It can also be used to add or remove old notices.',
        'centralnotice-query' => 'Modify current campaigns',
        'centralnotice-notice-name' => 'Campaign name',
-       'centralnotice-end-date' => 'End date',
+       'centralnotice-end-date' => 'End date (UTC)',
        'centralnotice-enabled' => 'Enabled',
        'centralnotice-modify' => 'Submit',
        'centralnotice-view' => 'View',
@@ -77,7 +77,7 @@
        'centralnotice-remove-all' => 'Remove all',
        'centralnotice-items-selected' => '$1 {{PLURAL:$1|item|items}} 
selected',
        'centralnotice-project-name' => 'Project name',
-       'centralnotice-start-date' => 'Start date',
+       'centralnotice-start-date' => 'Start date (UTC)',
        'centralnotice-start-time' => 'Start time (UTC)',
        'centralnotice-end-time' => 'End time (UTC)',
        'centralnotice-assigned-templates' => 'Assigned banners',
diff --git a/modules/ext.centralNotice.interface/centralnotice.css 
b/modules/ext.centralNotice.interface/centralnotice.css
index 7a65f2f..3ca450c 100644
--- a/modules/ext.centralNotice.interface/centralnotice.css
+++ b/modules/ext.centralNotice.interface/centralnotice.css
@@ -37,6 +37,9 @@
 #preferences table#envpicker td {
        white-space:nowrap;
 }
+#preferences .cn-date-column {
+       white-space:nowrap;
+}
 #preferences div.cn-buttons {
        padding:1em;
 }
diff --git a/special/SpecialCentralNotice.php b/special/SpecialCentralNotice.php
index 642d54a..a2a8450 100644
--- a/special/SpecialCentralNotice.php
+++ b/special/SpecialCentralNotice.php
@@ -448,27 +448,17 @@
                                $rowCells .= Html::rawElement( 'td', array(), 
$countryList );
 
                                // Date and time calculations
-                               $start_timestamp = wfTimestamp( TS_MW, 
$row->not_start );
-                               $start_year = substr( $start_timestamp, 0, 4 );
-                               $start_month = substr( $start_timestamp, 4, 2 );
-                               $start_day = substr( $start_timestamp, 6, 2 );
-                               $start_hour = substr( $start_timestamp, 8, 2 );
-                               $start_min = substr( $start_timestamp, 10, 2 );
-                               $end_timestamp = wfTimestamp( TS_MW, 
$row->not_end );
-                               $end_year = substr( $end_timestamp, 0, 4 );
-                               $end_month = substr( $end_timestamp, 4, 2 );
-                               $end_day = substr( $end_timestamp, 6, 2 );
-                               $end_hour = substr( $end_timestamp, 8, 2 );
-                               $end_min = substr( $end_timestamp, 10, 2 );
+                               $start_timestamp = wfTimestamp( TS_UNIX, 
$row->not_start );
+                               $end_timestamp = wfTimestamp( TS_UNIX, 
$row->not_end );
 
                                // Start
-                               $rowCells .= Html::rawElement( 'td', array(),
-                                       
"{$start_year}/{$start_month}/{$start_day} {$start_hour}:{$start_min}"
+                               $rowCells .= Html::rawElement( 'td', array( 
'class' => 'cn-date-column' ),
+                                       date( '<\b>Y-m-d</\b> H:i', 
$start_timestamp )
                                );
 
                                // End
-                               $rowCells .= Html::rawElement( 'td', array(),
-                                       "{$end_year}/{$end_month}/{$end_day} 
{$end_hour}:{$end_min}"
+                               $rowCells .= Html::rawElement( 'td', array( 
'class' => 'cn-date-column' ),
+                                       date( '<\b>Y-m-d</\b> H:i', 
$end_timestamp )
                                );
 
                                // Enabled

-- 
To view, visit https://gerrit.wikimedia.org/r/55810
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18854e8734f91efa59bb23a8191316a23929fc3e
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to