jenkins-bot has submitted this change and it was merged.

Change subject: Round timestamps to the day when displaying date titles in 
Special:Notifications
......................................................................


Round timestamps to the day when displaying date titles in Special:Notifications

Bug: T141915
Change-Id: I5fcb78ac2fa168aa8bba90c467544fe3a6914ec3
---
M modules/ui/mw.echo.ui.DatedSubGroupListWidget.js
1 file changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/modules/ui/mw.echo.ui.DatedSubGroupListWidget.js 
b/modules/ui/mw.echo.ui.DatedSubGroupListWidget.js
index 24116fa..4e26b9f 100644
--- a/modules/ui/mw.echo.ui.DatedSubGroupListWidget.js
+++ b/modules/ui/mw.echo.ui.DatedSubGroupListWidget.js
@@ -12,7 +12,7 @@
         * @param {Object} [config] Configuration object
         */
        mw.echo.ui.DatedSubGroupListWidget = function 
MwEchoUiDatedSubGroupListWidget( controller, listModel, config ) {
-               var momentTimestamp, diff, fullDate,
+               var momentTimestamp, diff, fullDate, stringTimestamp,
                        now = moment(),
                        $primaryDate = $( '<span>' )
                                .addClass( 
'mw-echo-ui-datedSubGroupListWidget-title-primary' ),
@@ -42,9 +42,11 @@
                        }
                }, config ) );
 
-               momentTimestamp = moment.utc( this.model.getTimestamp() );
+               // Round all dates to the day they're in, as if they all 
happened at 00:00h
+               stringTimestamp = moment.utc( this.model.getTimestamp() 
).local().format( 'YYYY-MM-DD' );
+               momentTimestamp = moment( stringTimestamp );
                diff = now.diff( momentTimestamp, 'weeks' );
-               fullDate = momentTimestamp.local().format( 'LL' );
+               fullDate = momentTimestamp.format( 'LL' );
 
                $primaryDate.text( fullDate );
                if ( diff === 0 ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5fcb78ac2fa168aa8bba90c467544fe3a6914ec3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to