Skip to content
This repository

Fixed the meridiem value for Chinese. #222

Closed
wants to merge 2 commits into from

3 participants

Rocky Meza Tim Wood jimmyye
Rocky Meza

In Chinese, there are more values for the meridiem value than just AM and PM. There are values that mean morning, before noon, noon, afternoon, and night time. I had to modify moment.js to handle a callback or default to the previous behavior.

If you accept #221, I am pretty sure that you will have a merge conflict in the calendar day tests. Here is what those tests should look like:

// zh-cn.js
test.equal(moment(a).calendar(),                     "今天早上2点00",     "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(),      "今天早上2点25",     "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(),       "今天早上3点00",     "Now plus 1 hour");
test.equal(moment(a).add({ d: 1 }).calendar(),       "明天早上2点00",     "tomorrow at the same time");
test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天早上1点00",     "Now minus 1 hour");
test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天早上2点00",     "yesterday at the same time");
// zh-tw.js
test.equal(moment(a).calendar(),                     "今天早上2點00",     "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(),      "今天早上2點25",     "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(),       "今天早上3點00",     "Now plus 1 hour");
test.equal(moment(a).add({ d: 1 }).calendar(),       "明天早上2點00",     "tomorrow at the same time");
test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天早上1點00",     "Now minus 1 hour");
test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天早上2點00",     "yesterday at the same time");
Rocky Meza Fixed the meridiem value for Chinese.
In Chinese, there are more values for the meridiem value than just AM
and PM.  There are values that mean morning, before noon, noon,
afternoon, and night time.  I had to modify moment.js to handle a
callback or default to the previous behavior.
17aaf58
Tim Wood
Owner

Hmm, if we're adding moment.meridiem.lower and moment.meridiem.upper, should we just deprecate moment.meridiem.am/AM/pm/PM and default to hard coded am/pm?

I dont think any other languages use moment.meridiem.am besides south-east asian languages.

Rocky Meza

Are you saying that in all of the other language files, am/AM/pm/PM are all the same?

Tim Wood
Owner

Yes, am/pm are the same for all languages but Korean and Chinese.

Meridiem was added for the Korean translation, and I didn't know if any future language would need different strings for upper and lower case, hence the semi-redundant am/AM, pm/PM.

Rocky Meza

Is it possible to unify the meridiem method into one method? There is no point in having two methods if the only languages that would even use it don't even have uppercase/lowercase.

We could delete meridiem am/AM/pm/PM in all other language files and define a meridiem function that accepts hour, minute, case in those few languages that are different. That would shrink the filesize of most of the language definitions a little bit.

Tim Wood
Owner

Yeah, that's probably even better.

Rocky Meza

This is the line that I am talking about in #222

Rocky Meza

I went ahead and did that, but you don't have to merge that part of the pull request in if you don't want to.

I had to change something in the way that languages are added to moment that perhaps changed some functionality. I don't know if it is documented or intentional, but there is the capability for a language definition to inherit from another language definition. Previously, the language definition would inherit from the last language defined. Now it inherits from English. I don't know if this functionality was intentional. When I removed all of the meridiem references it broke the tests with regard to the languages after Korean.

Since English is default and is always available I decided that language definition files could inherit from it instead of disabling inheritance altogether.

Rocky Meza

The tests pass if we take off inheritance or if we use the English as a fallback. However, I don't know about people's custom language definition files, if indeed there are any.

Thoughts?

Tim Wood
Owner

Yeah, there's no way to know about people's own language files, but I think we can document the upgrade path and what was depreciated from 1.5 to 1.6.

I think inheriting from english is a good idea. It gives the idea of a solid base, unlike how it currently acts, where it depends on the previous language. It will certainly shrink down this file too.

https://github.com/timrwood/moment/blob/master/lang/en-gb.js

Tim Wood timrwood referenced this pull request from a commit March 23, 2012
Tim Wood remove am/AM/pm/PM from meridiem
Changing to a function.
#222 #228
b34ba94
Tim Wood
Owner

The pull request got botched, so I updated everything manually. Can you double check that the Chinese calendar day tests are correct?

b34ba94#L20R150
b34ba94#L21R150

Rocky Meza
Tim Wood
Owner

Yeah, they pass, but I kinda went about it backwards, copy/pasting the results of the test back into the unit tests themselves. If it all looks good to you, I'll close this out.

Tim Wood timrwood closed this March 26, 2012
Rocky Meza

fine by me

jimmyye

There is a bug in the meridiem function.

            meridiem : function (hour, minute, isLower) {
                if (hour < 9) {
                    return "早上";
                } else if (hour < 11 && minute < 30) {
                    return "上午";
                } else if (hour < 13 && minute < 30) {
                    return "中午";
                } else if (hour < 18) {
                    return "下午";
                } else {
                    return "晚上";
                }
            },

When 11:31 am, it should be "中午" (noon), but it becomes "下午" (afternoon).
&& minute < 30 is wrong and unnecessary because noon means 11:00 to 13:00 in China.
This should work:

            meridiem : function (hour, minute, isLower) {
                if (hour < 9) {
                    return "早上";
                } else if (hour < 11) {
                    return "上午";
                } else if (hour < 13) {
                    return "中午";
                } else if (hour < 18) {
                    return "下午";
                } else {
                    return "晚上";
                }
            },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Mar 23, 2012
Rocky Meza Fixed the meridiem value for Chinese.
In Chinese, there are more values for the meridiem value than just AM
and PM.  There are values that mean morning, before noon, noon,
afternoon, and night time.  I had to modify moment.js to handle a
callback or default to the previous behavior.
17aaf58
Rocky Meza remove am/AM/pm/PM from meridiem 6ff58e9
This page is out of date. Refresh to see the latest.
6  lang/ca.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : function () {
22 16
                     return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
6  lang/da.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY h:mm A",
12 12
                 LLLL : "dddd D. MMMM, YYYY h:mm A"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : '[I dag kl.] LT',
22 16
                 nextDay : '[I morgen kl.] LT',
6  lang/de.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D. MMMM YYYY LT",
12 12
                 LLLL : "dddd, D. MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: "[Heute um] LT",
22 16
                 sameElse: "L",
6  lang/en-gb.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd, D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : '[Today at] LT',
22 16
                 nextDay : '[Tomorrow at] LT',
6  lang/es.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : function () {
22 16
                     return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
6  lang/eu.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "YYYYko MMMMren D[a] LT",
12 12
                 LLLL : "dddd, YYYYko MMMMren D[a] LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : '[gaur] LT[etan]',
22 16
                 nextDay : '[bihar] LT[etan]',
6  lang/fr.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: "[Aujourd'hui à] LT",
22 16
                 nextDay: '[Demain à] LT',
6  lang/gl.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : function () {
22 16
                     return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
6  lang/it.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd, D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: '[Oggi alle] LT',
22 16
                 nextDay: '[Domani alle] LT',
9  lang/kr.js
@@ -11,12 +11,9 @@
11 11
                 LLL : "YYYY년 MMMM D일 LT",
12 12
                 LLLL : "YYYY년 MMMM D일 dddd LT"
13 13
             },
14  
-			meridiem : {
15  
-				AM : '오전',
16  
-				am : '오전',
17  
-				PM : '오후',
18  
-				pm : '오후'
19  
-			},
  14
+            meridiem : function (hour, minute, upperCase) {
  15
+              return hour > 11 ? '오후' : '오전' ;
  16
+            },
20 17
             calendar : {
21 18
                 sameDay : '오늘 LT',
22 19
                 nextDay : '내일 LT',
6  lang/nb.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: '[I dag klokken] LT',
22 16
                 nextDay: '[I morgen klokken] LT',
6  lang/nl.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: '[Vandaag om] LT',
22 16
                 nextDay: '[Morgen om] LT',
6  lang/pl.js
@@ -33,12 +33,6 @@
33 33
             LLL : "D MMMM YYYY LT",
34 34
             LLLL : "dddd, D MMMM YYYY LT"
35 35
         },
36  
-        meridiem : {
37  
-            AM : 'AM',
38  
-            am : 'am',
39  
-            PM : 'PM',
40  
-            pm : 'pm'
41  
-        },
42 36
         calendar : {
43 37
             sameDay: '[Dziś o] LT',
44 38
             nextDay: '[Jutro o] LT',
6  lang/pt.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D \\de MMMM \\de YYYY LT",
12 12
                 LLLL : "dddd, D \\de MMMM \\de YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: '[Hoje às] LT',
22 16
                 nextDay: '[Amanhã às] LT',
6  lang/sv.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay: '[Idag klockan] LT',
22 16
                 nextDay: '[Imorgon klockan] LT',
6  lang/tr.js
@@ -11,12 +11,6 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd, D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : 'AM',
16  
-                am : 'am',
17  
-                PM : 'PM',
18  
-                pm : 'pm'
19  
-            },
20 14
             calendar : {
21 15
                 sameDay : '[bugün saat] LT',
22 16
                 nextDay : '[yarın saat] LT',
17  lang/zh-cn.js
@@ -11,11 +11,18 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd, D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : '上午',
16  
-                am : '上午',
17  
-                PM : '下午',
18  
-                pm : '下午'
  14
+            meridiem : function (hour, minute, upperCase) {
  15
+                if (hour < 9) {
  16
+                    return "早上";
  17
+                } else if (hour < 11 && minute < 30) {
  18
+                    return "上午";
  19
+                } else if (hour < 13 && minute < 30) {
  20
+                    return "中午";
  21
+                } else if (hour < 18) {
  22
+                    return "下午";
  23
+                } else {
  24
+                    return "晚上";
  25
+                }
19 26
             },
20 27
             calendar : {
21 28
                 sameDay : '[今天] LT',
19  lang/zh-tw.js
@@ -11,11 +11,18 @@
11 11
                 LLL : "D MMMM YYYY LT",
12 12
                 LLLL : "dddd, D MMMM YYYY LT"
13 13
             },
14  
-            meridiem : {
15  
-                AM : '上午',
16  
-                am : '上午',
17  
-                PM : '下午',
18  
-                pm : '下午'
  14
+            meridiem : function (hour, minute, upperCase) {
  15
+                if (hour < 9) {
  16
+                    return "早上";
  17
+                } else if (hour < 11 && minute < 30) {
  18
+                    return "上午";
  19
+                } else if (hour < 13 && minute < 30) {
  20
+                    return "中午";
  21
+                } else if (hour < 18) {
  22
+                    return "下午";
  23
+                } else {
  24
+                    return "晚上";
  25
+                }
19 26
             },
20 27
             calendar : {
21 28
                 sameDay : '[今天] LT',
@@ -53,4 +60,4 @@
53 60
     if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
54 61
         this.moment.lang('zh-tw', lang);
55 62
     }
56  
-}());
  63
+}());
12  moment.js
@@ -165,9 +165,9 @@
165 165
                 return currentYear;
166 166
             // AM / PM
167 167
             case 'a' :
168  
-                return currentHours > 11 ? meridiem.pm : meridiem.am;
  168
+                return meridiem ? meridiem(currentHours, currentMinutes, false) : (currentHours > 11 ? 'pm' : 'am');
169 169
             case 'A' :
170  
-                return currentHours > 11 ? meridiem.PM : meridiem.AM;
  170
+                return meridiem ? meridiem(currentHours, currentMinutes, true) : (currentHours > 11 ? 'PM' : 'AM');
171 171
             // 24 HOUR
172 172
             case 'H' :
173 173
                 return currentHours;
@@ -500,7 +500,7 @@
500 500
         if (languages[key]) {
501 501
             for (i = 0; i < paramsToParse.length; i++) {
502 502
                 param = paramsToParse[i];
503  
-                moment[param] = languages[key][param] || moment[param];
  503
+                moment[param] = languages[key][param] || languages['en'][param];
504 504
             }
505 505
         } else {
506 506
             if (hasModule) {
@@ -523,12 +523,6 @@
523 523
             LLL : "MMMM D YYYY LT",
524 524
             LLLL : "dddd, MMMM D YYYY LT"
525 525
         },
526  
-        meridiem : {
527  
-            AM : 'AM',
528  
-            am : 'am',
529  
-            PM : 'PM',
530  
-            pm : 'pm'
531  
-        },
532 526
         calendar : {
533 527
             sameDay : '[Today at] LT',
534 528
             nextDay : '[Tomorrow at] LT',
31  test/lang/zh-cn.js
@@ -147,12 +147,12 @@ exports["lang:zh-cn"] = {
147 147
 
148 148
         var a = moment().hours(2).minutes(0).seconds(0);
149 149
 
150  
-        test.equal(moment(a).calendar(),                     "今天 2:00 上午",     "today at the same time");
151  
-        test.equal(moment(a).add({ m: 25 }).calendar(),      "今天 2:25 上午",     "Now plus 25 min");
152  
-        test.equal(moment(a).add({ h: 1 }).calendar(),       "今天 3:00 上午",     "Now plus 1 hour");
153  
-        test.equal(moment(a).add({ d: 1 }).calendar(),       "明天 2:00 上午",     "tomorrow at the same time");
154  
-        test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天 1:00 上午",     "Now minus 1 hour");
155  
-        test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天 2:00 上午",     "yesterday at the same time");
  150
+        test.equal(moment(a).calendar(),                     "今天 2:00 早上",     "today at the same time");
  151
+        test.equal(moment(a).add({ m: 25 }).calendar(),      "今天 2:25 早上",     "Now plus 25 min");
  152
+        test.equal(moment(a).add({ h: 1 }).calendar(),       "今天 3:00 早上",     "Now plus 1 hour");
  153
+        test.equal(moment(a).add({ d: 1 }).calendar(),       "明天 2:00 早上",     "tomorrow at the same time");
  154
+        test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天 1:00 早上",     "Now minus 1 hour");
  155
+        test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天 2:00 早上",     "yesterday at the same time");
156 156
         test.done();
157 157
     },
158 158
 
@@ -204,5 +204,24 @@ exports["lang:zh-cn"] = {
204 204
         test.equal(weeksAgo.calendar(),       weeksAgo.format('L'),      "2 weeks ago");
205 205
         test.equal(weeksFromNow.calendar(),   weeksFromNow.format('L'),  "in 2 weeks");
206 206
     test.done();
  207
+    },
  208
+
  209
+    "meridiem" : function(test) {
  210
+        test.expect(10);
  211
+        moment.lang('zh-cn');
  212
+
  213
+        test.equal(moment([2011, 2, 23,  0, 0]).format('a'), "早上", "morning");
  214
+        test.equal(moment([2011, 2, 23,  9, 0]).format('a'), "上午", "before noon");
  215
+        test.equal(moment([2011, 2, 23, 12, 0]).format('a'), "中午", "noon");
  216
+        test.equal(moment([2011, 2, 23, 13, 0]).format('a'), "下午", "after noon");
  217
+        test.equal(moment([2011, 2, 23, 18, 0]).format('a'), "晚上", "night");
  218
+
  219
+        test.equal(moment([2011, 2, 23,  0, 0]).format('A'), "早上", "morning");
  220
+        test.equal(moment([2011, 2, 23,  9, 0]).format('A'), "上午", "before noon");
  221
+        test.equal(moment([2011, 2, 23, 12, 0]).format('A'), "中午", "noon");
  222
+        test.equal(moment([2011, 2, 23, 13, 0]).format('A'), "下午", "afternoon");
  223
+        test.equal(moment([2011, 2, 23, 18, 0]).format('A'), "晚上", "night");
  224
+
  225
+        test.done();
207 226
     }
208 227
 };
33  test/lang/zh-tw.js
@@ -147,12 +147,12 @@ exports["lang:zh-tw"] = {
147 147
 
148 148
         var a = moment().hours(2).minutes(0).seconds(0);
149 149
 
150  
-        test.equal(moment(a).calendar(),                     "今天 2:00 上午",     "today at the same time");
151  
-        test.equal(moment(a).add({ m: 25 }).calendar(),      "今天 2:25 上午",     "Now plus 25 min");
152  
-        test.equal(moment(a).add({ h: 1 }).calendar(),       "今天 3:00 上午",     "Now plus 1 hour");
153  
-        test.equal(moment(a).add({ d: 1 }).calendar(),       "明天 2:00 上午",     "tomorrow at the same time");
154  
-        test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天 1:00 上午",     "Now minus 1 hour");
155  
-        test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天 2:00 上午",     "yesterday at the same time");
  150
+        test.equal(moment(a).calendar(),                     "今天 2:00 早上",     "today at the same time");
  151
+        test.equal(moment(a).add({ m: 25 }).calendar(),      "今天 2:25 早上",     "Now plus 25 min");
  152
+        test.equal(moment(a).add({ h: 1 }).calendar(),       "今天 3:00 早上",     "Now plus 1 hour");
  153
+        test.equal(moment(a).add({ d: 1 }).calendar(),       "明天 2:00 早上",     "tomorrow at the same time");
  154
+        test.equal(moment(a).subtract({ h: 1 }).calendar(),  "今天 1:00 早上",     "Now minus 1 hour");
  155
+        test.equal(moment(a).subtract({ d: 1 }).calendar(),  "昨天 2:00 早上",     "yesterday at the same time");
156 156
         test.done();
157 157
     },
158 158
 
@@ -204,5 +204,24 @@ exports["lang:zh-tw"] = {
204 204
         test.equal(weeksAgo.calendar(),       weeksAgo.format('L'),      "2 weeks ago");
205 205
         test.equal(weeksFromNow.calendar(),   weeksFromNow.format('L'),  "in 2 weeks");
206 206
     test.done();
  207
+    },
  208
+
  209
+    "meridiem" : function(test) {
  210
+        test.expect(10);
  211
+        moment.lang('zh-cn');
  212
+
  213
+        test.equal(moment([2011, 2, 23,  0, 0]).format('a'), "早上", "morning");
  214
+        test.equal(moment([2011, 2, 23,  9, 0]).format('a'), "上午", "before noon");
  215
+        test.equal(moment([2011, 2, 23, 12, 0]).format('a'), "中午", "noon");
  216
+        test.equal(moment([2011, 2, 23, 13, 0]).format('a'), "下午", "after noon");
  217
+        test.equal(moment([2011, 2, 23, 18, 0]).format('a'), "晚上", "night");
  218
+
  219
+        test.equal(moment([2011, 2, 23,  0, 0]).format('A'), "早上", "morning");
  220
+        test.equal(moment([2011, 2, 23,  9, 0]).format('A'), "上午", "before noon");
  221
+        test.equal(moment([2011, 2, 23, 12, 0]).format('A'), "中午", "noon");
  222
+        test.equal(moment([2011, 2, 23, 13, 0]).format('A'), "下午", "afternoon");
  223
+        test.equal(moment([2011, 2, 23, 18, 0]).format('A'), "晚上", "night");
  224
+
  225
+        test.done();
207 226
     }
208  
-};
  227
+};
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.