ソースを参照

fix(date.js): 完善getNumTwoBit方法逻辑

Frans 6 年 前
コミット
c250bcb8e2
1 ファイル変更4 行追加3 行削除
  1. 4 3
      src/utils/date.js

+ 4 - 3
src/utils/date.js

@@ -23,8 +23,8 @@ let Utils = {
      * @return {Number}
      */
     getMonthPreDay: function(year, month) {
-        var date = new Date(year + '/' + month + '/01');
-        var day = date.getDay();
+        let date = new Date(year + '/' + month + '/01');
+        let day = date.getDay();
         if (day == 0) {
             day = 7;
         }
@@ -47,7 +47,8 @@ let Utils = {
 	 * @return {string}
 	 */
 	getNumTwoBit: function(n) {
-	    return (n > 9 ? '' : '0') + n;
+		n = Number(n);
+		return (n > 9 ? '' : '0') + n;
 	},
 
 	/**