瀏覽代碼

DatePicker: use fecha i18n (#5485)

杨奕 8 年之前
父節點
當前提交
005415143c
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      packages/date-picker/src/util/index.js

+ 11 - 0
packages/date-picker/src/util/index.js

@@ -1,4 +1,15 @@
 import dateUtil from 'element-ui/src/utils/date';
+import { t } from 'element-ui/src/locale';
+
+const weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
+const months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
+
+dateUtil.i18n = {
+  dayNamesShort: weeks.map(week => t(`el.datepicker.weeks.${ week }`)),
+  dayNames: weeks.map(week => t(`el.datepicker.weeks.${ week }`)),
+  monthNamesShort: months.map(month => t(`el.datepicker.months.${ month }`)),
+  monthNames: months.map((month, index) => t(`el.datepicker.month${ index + 1 }`))
+};
 
 const newArray = function(start, end) {
   let result = [];