@pisell/materials 2.2.37 → 2.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
1
  import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ import 'dayjs/locale/en';
4
+ import 'dayjs/locale/zh-tw';
2
5
  declare type RType = (url: string, data?: {} | undefined, config?: {} | undefined) => Promise<any>;
3
6
  declare class Request {
4
7
  private request;
@@ -68,7 +71,7 @@ export declare const findNextSlice: ({ timeSlices, index, date, }: {
68
71
  date?: string | undefined;
69
72
  }) => any;
70
73
  export declare const findNextDuration: (current: any, array: any, defaultValue?: any) => any;
71
- export declare const formatProductListByCategory: (list: any, filterItem: any) => unknown[];
74
+ export declare const formatProductListByCategory: (list: any, filterItem: any) => any;
72
75
  export declare const getResourceTimeIsUsable: (item: any, cacheItem: any) => any;
73
76
  /**
74
77
  * @title: 查找是否有可用的time
@@ -16,6 +16,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
16
16
  import dayjs from 'dayjs';
17
17
  import { locales } from '@pisell/utils';
18
18
  import { intersectionBy } from 'lodash';
19
+ import 'dayjs/locale/zh-cn';
20
+ import 'dayjs/locale/en';
21
+ import 'dayjs/locale/zh-tw';
19
22
  var Request = /*#__PURE__*/function () {
20
23
  function Request() {
21
24
  _classCallCheck(this, Request);
@@ -149,7 +152,13 @@ export var getServiceTime = function getServiceTime(item, currentDate) {
149
152
  if (!currentDate || !(item !== null && item !== void 0 && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.start_time) || !dayjs(currentDate).isValid()) return '';
150
153
  var locale = (item === null || item === void 0 ? void 0 : item.locale) || 'en-US';
151
154
  var isEn = locale === 'en-US' || locale === 'en';
152
- dayjs.locale(locale);
155
+ var localeTypes = {
156
+ 'en-US': 'en',
157
+ 'zh-CN': 'zh-cn',
158
+ 'zh-HK': 'zh-tw'
159
+ };
160
+ dayjs.locale(localeTypes[locale]);
161
+ console.log(locale, 'wh_locale');
153
162
  var startDate = dayjs((currentDate === null || currentDate === void 0 ? void 0 : currentDate.format('YYYY-MM-DD')) + ' ' + getServeStartTime(item === null || item === void 0 ? void 0 : (_item$_extend2 = item._extend) === null || _item$_extend2 === void 0 ? void 0 : _item$_extend2.start_time));
154
163
  var startTime = startDate.format('HH:mm');
155
164
 
@@ -1,4 +1,7 @@
1
1
  import dayjs from 'dayjs';
2
+ import 'dayjs/locale/zh-cn';
3
+ import 'dayjs/locale/en';
4
+ import 'dayjs/locale/zh-tw';
2
5
  declare type RType = (url: string, data?: {} | undefined, config?: {} | undefined) => Promise<any>;
3
6
  declare class Request {
4
7
  private request;
@@ -68,7 +71,7 @@ export declare const findNextSlice: ({ timeSlices, index, date, }: {
68
71
  date?: string | undefined;
69
72
  }) => any;
70
73
  export declare const findNextDuration: (current: any, array: any, defaultValue?: any) => any;
71
- export declare const formatProductListByCategory: (list: any, filterItem: any) => unknown[];
74
+ export declare const formatProductListByCategory: (list: any, filterItem: any) => any;
72
75
  export declare const getResourceTimeIsUsable: (item: any, cacheItem: any) => any;
73
76
  /**
74
77
  * @title: 查找是否有可用的time
@@ -60,6 +60,9 @@ module.exports = __toCommonJS(utils_exports);
60
60
  var import_dayjs = __toESM(require("dayjs"));
61
61
  var import_utils = require("@pisell/utils");
62
62
  var import_lodash = require("lodash");
63
+ var import_zh_cn = require("dayjs/locale/zh-cn");
64
+ var import_en = require("dayjs/locale/en");
65
+ var import_zh_tw = require("dayjs/locale/zh-tw");
63
66
  var Request = class {
64
67
  constructor() {
65
68
  this.request = {};
@@ -142,7 +145,13 @@ var getServiceTime = (item, currentDate) => {
142
145
  return "";
143
146
  const locale = (item == null ? void 0 : item.locale) || "en-US";
144
147
  const isEn = locale === "en-US" || locale === "en";
145
- import_dayjs.default.locale(locale);
148
+ const localeTypes = {
149
+ "en-US": "en",
150
+ "zh-CN": "zh-cn",
151
+ "zh-HK": "zh-tw"
152
+ };
153
+ import_dayjs.default.locale(localeTypes[locale]);
154
+ console.log(locale, "wh_locale");
146
155
  const startDate = (0, import_dayjs.default)(
147
156
  (currentDate == null ? void 0 : currentDate.format("YYYY-MM-DD")) + " " + getServeStartTime((_b = item == null ? void 0 : item._extend) == null ? void 0 : _b.start_time)
148
157
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "2.2.37",
3
+ "version": "2.2.38",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",