]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Cleaning up whitespace and trimming bytes
authorTim Wood <washwithcare@gmail.com>
Wed, 28 Dec 2011 18:54:01 +0000 (10:54 -0800)
committerTim Wood <washwithcare@gmail.com>
Wed, 28 Dec 2011 18:54:01 +0000 (10:54 -0800)
moment.js

index 853111a11b6b6738f2e94a6065d23eb10d066ce7..4167f7270983313e0b05e6b9ba4f87fe848d80e6 100644 (file)
--- a/moment.js
+++ b/moment.js
         monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
         weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
         weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
-        longDateFormat : { 
+        longDateFormat : {
             LT : "h:mm A",
             L : "MM/DD/YYYY",
             LL : "MMMM D YYYY",
     // helper function for _date.from() and _date.fromNow()
     function substituteTimeAgo(string, number, withoutSuffix) {
         var rt = moment.relativeTime[string];
-        return (typeof rt === 'function') ? 
-            rt(number || 1, !!withoutSuffix, string) : 
+        return (typeof rt === 'function') ?
+            rt(number || 1, !!withoutSuffix, string) :
             rt.replace(/%d/i, number || 1);
     }
 
 
         diff : function (input, val, asFloat) {
             var inputMoment = moment(input),
-                diff = this._d - inputMoment._d, 
-                year = this.year() - inputMoment.year(), 
-                month = this.month() - inputMoment.month(), 
+                diff = this._d - inputMoment._d,
+                year = this.year() - inputMoment.year(),
+                month = this.month() - inputMoment.month(),
                 day = this.day() - inputMoment.day(),
                 output;
             if (val === 'months') {
         },
 
         calendar : function () {
-            var todayAtZeroHour = moment().hours(0).minutes(0).seconds(0).milliseconds(0),
+            var today = moment(),
+                todayAtZeroHour = moment([today.year(), today.month(), today.date()]),
                 diff = this.diff(todayAtZeroHour, 'days', true),
                 calendar = moment.calendar,
                 allElse = calendar.sameElse,
-                format = diff < -6 ? allElse : 
+                format = diff < -6 ? allElse :
                 diff < -1 ? calendar.lastWeek :
                 diff < 0 ? calendar.lastDay :
                 diff < 1 ? calendar.sameDay :