]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
use "点整" for this.minutes() === 0
authorZeno Zeng <zenoes@qq.com>
Fri, 13 Sep 2013 17:03:52 +0000 (01:03 +0800)
committerZeno Zeng <zenoes@qq.com>
Fri, 13 Sep 2013 17:03:52 +0000 (01:03 +0800)
use "本周" for current week

lang/zh-cn.js

index 6d9b67e313cdf01ab1d63b1980d21c39e1f08689..462c1b9f2762e8fa3dcc82fe532cd7a1bb26a6dc 100644 (file)
             }
         },
         calendar : {
-            sameDay : '[今天]LT',
-            nextDay : '[明天]LT',
-            nextWeek : '[下]ddddLT',
-            lastDay : '[昨天]LT',
-            lastWeek : '[上]ddddLT',
+            sameDay : function() {
+                return this.minutes() === 0 ? "[今天]Ah[点整]" : "[今天]T";
+            },
+            nextDay : function() {
+                return this.minutes() === 0 ? "[明天]Ah[点整]" : "[明天]T";
+            },
+            lastDay : function() {
+                return this.minutes() === 0 ? "[昨天]Ah[点整]" : "[昨天]T";
+            },
+            nextWeek : function() {
+                var startOfWeek, prefix;
+                startOfWeek = moment().startOf('week');
+                prefix = this.unix() - startOfWeek.unix() > 7*24*3600 ? '[下]' : '[本]';
+                return this.minutes() === 0 ? prefix+"dddAh点整" : prefix+"dddAh点mm";
+            },
+            lastWeek : function() {
+                var startOfWeek, prefix;
+                startOfWeek = moment().startOf('week');
+                prefix = this.unix() < startOfWeek.unix()  ? '[上]' : '[本]';
+                return this.minutes() === 0 ? prefix+"dddAh点整" : prefix+"dddAh点mm";
+            },
             sameElse : 'L'
         },
         ordinal : function (number, period) {
             switch (period) {
-            case "d" :
-            case "D" :
-            case "DDD" :
+                case "d" :
+                case "D" :
+                case "DDD" :
                 return number + "日";
-            case "M" :
+                case "M" :
                 return number + "月";
-            case "w" :
-            case "W" :
+                case "w" :
+                case "W" :
                 return number + "周";
-            default :
+                default :
                 return number;
             }
         },