From: Zeno Zeng Date: Sat, 14 Sep 2013 13:38:07 +0000 (+0800) Subject: Fixed wrong Chinese meridiem time, based on pull request #1056 X-Git-Tag: 2.4.0~17^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=728ae39691d800bbb511ca04f1833e170cd0004c;p=thirdparty%2Fmoment.git Fixed wrong Chinese meridiem time, based on pull request #1056 --- diff --git a/lang/zh-cn.js b/lang/zh-cn.js index 2f686065c..bffadbad8 100644 --- a/lang/zh-cn.js +++ b/lang/zh-cn.js @@ -1,6 +1,7 @@ // moment.js language configuration // language : chinese // author : suupic : https://github.com/suupic +// author : Zeno Zeng : https://github.com/zenozeng (function (factory) { if (typeof define === 'function' && define.amd) { @@ -29,56 +30,57 @@ llll : "YYYY年MMMD日ddddLT" }, meridiem : function (hour, minute, isLower) { - if (hour < 6) { + var hm = hour*100 + minute; + if (hm < 600) { return "凌晨"; - } else if (hour < 9) { + } else if (hm < 900) { return "早上"; - } else if (hour < 11 && minute < 30) { + } else if (hm < 1130) { return "上午"; - } else if (hour < 13 && minute < 30) { + } else if (hm < 1230) { return "中午"; - } else if (hour < 18) { + } else if (hm < 1800) { return "下午"; } else { return "晚上"; } }, calendar : { - sameDay : function() { + sameDay : function () { return this.minutes() === 0 ? "[今天]Ah[点整]" : "[今天]T"; }, - nextDay : function() { + nextDay : function () { return this.minutes() === 0 ? "[明天]Ah[点整]" : "[明天]T"; }, - lastDay : function() { + lastDay : function () { return this.minutes() === 0 ? "[昨天]Ah[点整]" : "[昨天]T"; }, - nextWeek : function() { + 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"; + prefix = this.unix() - startOfWeek.unix() > 7 * 24 * 3600 ? '[下]' : '[本]'; + return this.minutes() === 0 ? prefix + "dddAh点整" : prefix + "dddAh点mm"; }, - lastWeek : function() { + lastWeek : function () { var startOfWeek, prefix; startOfWeek = moment().startOf('week'); prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]'; - return this.minutes() === 0 ? prefix+"dddAh点整" : prefix+"dddAh点mm"; + 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; } },