]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
names the function relativeDate() rahter than xxx()
authorPierre Spring <pierre@nelm.io>
Fri, 2 Dec 2011 09:03:07 +0000 (10:03 +0100)
committerPierre Spring <pierre@nelm.io>
Fri, 2 Dec 2011 09:03:07 +0000 (10:03 +0100)
moment.js

index 44dffe900f912522bc9f37061f8d4287d6138390..467af6fa3633372ed16d0ceaa1494ee6ab1f7462 100644 (file)
--- a/moment.js
+++ b/moment.js
         relativeDate : {
             today: 'Today at %time',
             tomorrow: 'Tomorrow at %time',
-            next: 'next %weekday at %time', // e.g. next Friday
+            next: '%weekday at %time', // e.g. Friday at 13:45
             yesterday: 'Yesterday at %time',
-            last: 'last %weekday at %time' // e.g. last Sunday
+            last: 'last %weekday at %time' // e.g. last Sunday at 13:45
         },
         relativeTime : {
             future : "in %s",
             return this.from(moment(), withoutSuffix);
         },
 
-        xxx : function () {
+        relativeDate : function () {
             var format = 'YYYY DDDD',
                 unixTimestamp = this.valueOf(),
-                yyy, nextWeek, lastWeek;
+                arrayKey, nextWeek, lastWeek;
 
             switch (this.format(format)) {
             case moment().format(format):
-                yyy = 'today';
+                arrayKey = 'today';
                 break;
             case moment().add('days', 1).format(format):
-                yyy = 'tomorrow';
+                arrayKey = 'tomorrow';
                 break;
             case moment().subtract('days', 1).format(format):
-                yyy = 'yesterday';
+                arrayKey = 'yesterday';
                 break;
             }
 
-            if ('undefined' === typeof yyy) {
+            if ('undefined' === typeof arrayKey) {
                 nextWeek = moment().add('weeks', 1).hours(23).minutes(59).seconds(59);
                 lastWeek = moment().subtract('weeks', 1).hours(0).minutes(0).seconds(0);
 
                 if (nextWeek.valueOf() > unixTimestamp && lastWeek.valueOf() < unixTimestamp) {
                     if (moment().valueOf() < unixTimestamp) {
-                        yyy = 'next';
+                        arrayKey = 'next';
                     } else {
-                        yyy = 'last';
+                        arrayKey = 'last';
                     }
                 }
             }
 
-            if (yyy) {
-                return moment.relativeDate[yyy].replace('%weekday', this.format('dddd')).replace('%time', this.format('HH:mm'));
+            if (arrayKey) {
+                return moment.relativeDate[arrayKey].replace('%weekday', this.format('dddd')).replace('%time', this.format('HH:mm'));
             }
 
             return this.format('L');