UNPKG

zarm

Version:

基于 React 的移动端UI库

36 lines (30 loc) 808 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function parseDataSource(months, locale) { var dataSource = {}; for (var i = 0; i < months.length; i++) { var year = months[i].getFullYear(); var month = months[i].getMonth(); if (!dataSource[year]) { dataSource[year] = { value: year, label: year, children: [{ value: month, label: locale === null || locale === void 0 ? void 0 : locale.months[month] }] }; } else { dataSource[year].children.push({ value: month, label: locale === null || locale === void 0 ? void 0 : locale.months[month] }); } } return dataSource; } var _default = parseDataSource; exports.default = _default;