zartui 2.1.5 → 2.1.7

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.
Files changed (378) hide show
  1. package/es/action-sheet/index.js +15 -26
  2. package/es/area/index.js +5 -41
  3. package/es/avatar/index.js +3 -16
  4. package/es/back-top/index.js +4 -19
  5. package/es/badge/index.js +4 -12
  6. package/es/button/index.js +20 -40
  7. package/es/calendar/components/Header.js +3 -12
  8. package/es/calendar/components/Month.js +12 -65
  9. package/es/calendar/index.js +23 -94
  10. package/es/calendar/types.js +9 -15
  11. package/es/calendar/utils.js +5 -16
  12. package/es/cascader/index.js +4 -37
  13. package/es/cell/index.js +19 -37
  14. package/es/cell-group/index.js +5 -8
  15. package/es/checkbox/index.js +4 -11
  16. package/es/checkbox-group/index.js +4 -9
  17. package/es/col/index.js +6 -11
  18. package/es/collapse/index.js +2 -5
  19. package/es/collapse-item/index.js +19 -35
  20. package/es/count-down/index.js +2 -15
  21. package/es/count-down/utils.js +3 -10
  22. package/es/datetime-picker/DatePicker.js +12 -70
  23. package/es/datetime-picker/TimePicker.js +10 -23
  24. package/es/datetime-picker/index.js +2 -26
  25. package/es/datetime-picker/shared.js +5 -21
  26. package/es/datetime-picker/utils.js +0 -5
  27. package/es/dialog/Dialog.js +6 -21
  28. package/es/dialog/index.js +0 -16
  29. package/es/divider/index.js +5 -6
  30. package/es/dropdown-item/index.js +13 -39
  31. package/es/dropdown-menu/index.js +4 -9
  32. package/es/empty/images/Developing.js +0 -3
  33. package/es/empty/images/EmptyInterface.js +0 -3
  34. package/es/empty/images/EmptyResult.js +0 -3
  35. package/es/empty/images/FindNull.js +0 -3
  36. package/es/empty/images/NetworkError.js +0 -3
  37. package/es/empty/images/NotFound.js +0 -3
  38. package/es/empty/images/ReportSuccess.js +0 -3
  39. package/es/empty/images/Restricted.js +0 -3
  40. package/es/empty/images/ServerError.js +0 -3
  41. package/es/empty/index.js +3 -11
  42. package/es/field/index.js +21 -86
  43. package/es/fold-dialog/index.js +5 -20
  44. package/es/form/index.js +2 -18
  45. package/es/grid/index.js +2 -6
  46. package/es/grid-item/index.js +18 -30
  47. package/es/hierarchy-select/breadcrumb.js +2 -6
  48. package/es/hierarchy-select/index.js +13 -15
  49. package/es/hierarchy-select/markList.js +11 -32
  50. package/es/hierarchy-select/svg/SubIcon.js +0 -1
  51. package/es/icon/index.js +9 -13
  52. package/es/image/index.js +3 -19
  53. package/es/image-preview/ImagePreview.js +4 -8
  54. package/es/image-preview/ImagePreviewItem.js +14 -30
  55. package/es/image-preview/index.js +0 -12
  56. package/es/image-preview/shared.js +2 -4
  57. package/es/index-anchor/index.js +2 -6
  58. package/es/index-bar/IndexIndicate.js +0 -1
  59. package/es/index-bar/index.js +7 -28
  60. package/es/index.js +1 -4
  61. package/es/info/index.js +6 -8
  62. package/es/list/index.js +11 -27
  63. package/es/loading/index.js +7 -15
  64. package/es/locale/index.js +0 -2
  65. package/es/media-picker/index.js +34 -120
  66. package/es/media-picker/media-util.js +2 -5
  67. package/es/media-picker/type.js +9 -14
  68. package/es/media-picker/wx-util.js +0 -1
  69. package/es/media-player/index.js +7 -19
  70. package/es/mixins/bind-event.js +0 -3
  71. package/es/mixins/checkbox.js +5 -11
  72. package/es/mixins/click-outside.js +0 -2
  73. package/es/mixins/close-on-popstate.js +0 -1
  74. package/es/mixins/field.js +0 -2
  75. package/es/mixins/popup/index.js +12 -28
  76. package/es/mixins/popup/overlay.js +1 -11
  77. package/es/mixins/portal.js +2 -8
  78. package/es/mixins/relation.js +0 -8
  79. package/es/mixins/slots.js +1 -4
  80. package/es/mixins/touch.js +4 -9
  81. package/es/multiple-picker/MultiplePickerOptions.js +3 -20
  82. package/es/multiple-picker/index.js +5 -17
  83. package/es/nav-bar/index.js +4 -12
  84. package/es/notice-bar/index.js +10 -28
  85. package/es/number-keyboard/Key.js +2 -10
  86. package/es/number-keyboard/index.js +4 -19
  87. package/es/overlay/index.js +5 -8
  88. package/es/password-input/index.js +10 -16
  89. package/es/picker/PickerColumn.js +21 -56
  90. package/es/picker/index.js +12 -45
  91. package/es/popover/index.js +65 -90
  92. package/es/popup/index.js +5 -21
  93. package/es/pull-refresh/index.js +10 -29
  94. package/es/radio/index.js +2 -4
  95. package/es/radio-group/index.js +2 -4
  96. package/es/rate/index.js +12 -26
  97. package/es/row/index.js +3 -9
  98. package/es/search/index.js +9 -15
  99. package/es/signature/bezier.js +13 -20
  100. package/es/signature/force-landscape.js +0 -5
  101. package/es/signature/index.js +5 -24
  102. package/es/signature/point.js +1 -6
  103. package/es/signature/throttle.js +1 -10
  104. package/es/skeleton/index.js +5 -15
  105. package/es/slider/index.js +19 -55
  106. package/es/step/index.js +5 -12
  107. package/es/stepper/index.js +11 -39
  108. package/es/steps/index.js +2 -4
  109. package/es/sticky/index.js +8 -50
  110. package/es/swipe/index.js +19 -62
  111. package/es/swipe-cell/index.js +7 -23
  112. package/es/swipe-item/index.js +10 -19
  113. package/es/switch/index.js +8 -10
  114. package/es/switch/shared.js +1 -0
  115. package/es/switch-cell/index.js +7 -7
  116. package/es/tab/index.js +4 -15
  117. package/es/tabbar/index.js +4 -14
  118. package/es/tabbar-item/index.js +7 -15
  119. package/es/table/index.js +5 -28
  120. package/es/table/type.js +3 -4
  121. package/es/tabs/Content.js +5 -9
  122. package/es/tabs/Title.js +11 -20
  123. package/es/tabs/index.js +16 -51
  124. package/es/tabs/utils.js +0 -8
  125. package/es/tag/index.js +13 -17
  126. package/es/text-ellipsis/index.js +25 -42
  127. package/es/timeline/index.js +2 -25
  128. package/es/toast/Toast.js +11 -23
  129. package/es/toast/index.js +6 -33
  130. package/es/toast/lock-click.js +0 -2
  131. package/es/uploader/index.js +11 -62
  132. package/es/uploader/utils.js +0 -10
  133. package/es/utils/constant.js +2 -1
  134. package/es/utils/create/bem.js +1 -5
  135. package/es/utils/create/component.js +4 -8
  136. package/es/utils/create/i18n.js +0 -2
  137. package/es/utils/deep-assign.js +0 -4
  138. package/es/utils/deep-clone.js +0 -3
  139. package/es/utils/dom/event.js +2 -5
  140. package/es/utils/dom/node.js +0 -1
  141. package/es/utils/dom/raf.js +7 -6
  142. package/es/utils/dom/reset-scroll.js +2 -1
  143. package/es/utils/dom/scroll.js +8 -17
  144. package/es/utils/dom/style.js +3 -2
  145. package/es/utils/easings.js +2 -4
  146. package/es/utils/format/date-util.js +54 -122
  147. package/es/utils/format/number.js +2 -11
  148. package/es/utils/format/string.js +0 -3
  149. package/es/utils/format/unit.js +2 -12
  150. package/es/utils/functional.js +6 -9
  151. package/es/utils/getScroll.js +0 -5
  152. package/es/utils/index.js +3 -5
  153. package/es/utils/interceptor.js +2 -4
  154. package/es/utils/media/image-util.js +7 -19
  155. package/es/utils/raf.js +4 -12
  156. package/es/utils/router.js +7 -6
  157. package/es/utils/scrollTo.js +10 -15
  158. package/es/utils/validate/number.js +2 -2
  159. package/es/utils/vnodes.js +2 -8
  160. package/lib/action-sheet/index.js +12 -37
  161. package/lib/area/index.js +7 -48
  162. package/lib/avatar/index.js +5 -21
  163. package/lib/back-top/index.js +6 -28
  164. package/lib/badge/index.js +6 -18
  165. package/lib/button/index.js +20 -52
  166. package/lib/calendar/FastForwardImg.js +2 -3
  167. package/lib/calendar/SlowForwardImg.js +2 -3
  168. package/lib/calendar/components/Header.js +5 -21
  169. package/lib/calendar/components/Month.js +14 -74
  170. package/lib/calendar/index.js +23 -109
  171. package/lib/calendar/types.js +11 -22
  172. package/lib/calendar/utils.js +18 -46
  173. package/lib/cascader/index.js +6 -49
  174. package/lib/cell/index.js +19 -50
  175. package/lib/cell/shared.js +2 -3
  176. package/lib/cell-group/index.js +6 -17
  177. package/lib/checkbox/index.js +6 -17
  178. package/lib/checkbox-group/index.js +6 -16
  179. package/lib/col/index.js +8 -17
  180. package/lib/collapse/index.js +4 -11
  181. package/lib/collapse-item/index.js +20 -46
  182. package/lib/count-down/index.js +4 -22
  183. package/lib/count-down/utils.js +5 -17
  184. package/lib/datetime-picker/DatePicker.js +14 -84
  185. package/lib/datetime-picker/TimePicker.js +12 -33
  186. package/lib/datetime-picker/index.js +7 -41
  187. package/lib/datetime-picker/shared.js +9 -35
  188. package/lib/datetime-picker/utils.js +2 -11
  189. package/lib/dialog/Dialog.js +8 -31
  190. package/lib/dialog/index.js +1 -24
  191. package/lib/divider/index.js +6 -14
  192. package/lib/dropdown-item/index.js +14 -52
  193. package/lib/dropdown-menu/index.js +6 -18
  194. package/lib/empty/context.js +2 -3
  195. package/lib/empty/images/Developing.js +2 -9
  196. package/lib/empty/images/EmptyInterface.js +2 -9
  197. package/lib/empty/images/EmptyResult.js +2 -9
  198. package/lib/empty/images/FindNull.js +2 -9
  199. package/lib/empty/images/NetworkError.js +2 -9
  200. package/lib/empty/images/NotFound.js +2 -9
  201. package/lib/empty/images/ReportSuccess.js +2 -9
  202. package/lib/empty/images/Restricted.js +2 -9
  203. package/lib/empty/images/ServerError.js +2 -9
  204. package/lib/empty/index.js +5 -26
  205. package/lib/field/ClearIcon.js +2 -3
  206. package/lib/field/SearchIcon.js +2 -3
  207. package/lib/field/index.js +22 -99
  208. package/lib/fold-dialog/index.js +7 -25
  209. package/lib/form/index.js +4 -24
  210. package/lib/grid/index.js +4 -13
  211. package/lib/grid-item/index.js +19 -40
  212. package/lib/hierarchy-select/breadcrumb.js +5 -13
  213. package/lib/hierarchy-select/index.js +16 -26
  214. package/lib/hierarchy-select/markList.js +14 -41
  215. package/lib/hierarchy-select/svg/SubIcon.js +2 -4
  216. package/lib/icon/index.js +9 -21
  217. package/lib/image/index.js +4 -25
  218. package/lib/image-preview/ImagePreview.js +2 -19
  219. package/lib/image-preview/ImagePreviewItem.js +15 -39
  220. package/lib/image-preview/index.js +1 -18
  221. package/lib/image-preview/shared.js +3 -8
  222. package/lib/index-anchor/index.js +4 -14
  223. package/lib/index-bar/IndexIndicate.js +2 -4
  224. package/lib/index-bar/index.js +9 -40
  225. package/lib/index.js +5 -164
  226. package/lib/info/index.js +7 -16
  227. package/lib/lazyload/index.js +1 -5
  228. package/lib/list/index.js +12 -36
  229. package/lib/loading/index.js +8 -23
  230. package/lib/locale/index.js +2 -10
  231. package/lib/locale/lang/de-DE-formal.js +2 -3
  232. package/lib/locale/lang/de-DE.js +2 -3
  233. package/lib/locale/lang/en-US.js +2 -3
  234. package/lib/locale/lang/es-ES.js +2 -3
  235. package/lib/locale/lang/fr-FR.js +2 -3
  236. package/lib/locale/lang/ja-JP.js +2 -3
  237. package/lib/locale/lang/nb-NO.js +2 -3
  238. package/lib/locale/lang/ro-RO.js +2 -3
  239. package/lib/locale/lang/th-TH.js +2 -3
  240. package/lib/locale/lang/tr-TR.js +2 -3
  241. package/lib/locale/lang/zh-CN.js +2 -3
  242. package/lib/locale/lang/zh-HK.js +2 -3
  243. package/lib/locale/lang/zh-TW.js +2 -3
  244. package/lib/media-picker/image/DefaultAudioIcon.js +2 -3
  245. package/lib/media-picker/image/DefaultDocIcon.js +2 -3
  246. package/lib/media-picker/image/DefaultExcelIcon.js +2 -3
  247. package/lib/media-picker/image/DefaultFileIcon.js +2 -3
  248. package/lib/media-picker/image/DefaultPdfIcon.js +2 -3
  249. package/lib/media-picker/image/DefaultPptIcon.js +2 -3
  250. package/lib/media-picker/image/DefaultTextIcon.js +2 -3
  251. package/lib/media-picker/image/DefaultVideoIcon.js +2 -3
  252. package/lib/media-picker/image/DeleteIcon.js +2 -3
  253. package/lib/media-picker/image/Img64.js +4 -7
  254. package/lib/media-picker/image/PickFileIcon.js +2 -3
  255. package/lib/media-picker/image/PickPhotoIcon.js +2 -3
  256. package/lib/media-picker/image/ReUpload.js +2 -3
  257. package/lib/media-picker/image/TakeAudioIcon.js +2 -3
  258. package/lib/media-picker/image/TakePhotoIcon.js +2 -3
  259. package/lib/media-picker/image/TakeVideoIcon.js +2 -3
  260. package/lib/media-picker/index.js +32 -164
  261. package/lib/media-picker/media-util.js +9 -22
  262. package/lib/media-picker/type.js +10 -18
  263. package/lib/media-picker/wx-util.js +4 -15
  264. package/lib/media-player/index.js +8 -27
  265. package/lib/mixins/bind-event.js +1 -6
  266. package/lib/mixins/checkbox.js +8 -21
  267. package/lib/mixins/click-outside.js +3 -8
  268. package/lib/mixins/close-on-popstate.js +2 -7
  269. package/lib/mixins/field.js +2 -5
  270. package/lib/mixins/popup/context.js +2 -3
  271. package/lib/mixins/popup/index.js +12 -38
  272. package/lib/mixins/popup/overlay.js +3 -25
  273. package/lib/mixins/portal.js +2 -9
  274. package/lib/mixins/relation.js +0 -11
  275. package/lib/mixins/slots.js +3 -8
  276. package/lib/mixins/touch.js +6 -14
  277. package/lib/multiple-picker/MultiplePickerOptions.js +4 -26
  278. package/lib/multiple-picker/index.js +7 -29
  279. package/lib/multiple-picker/shared.js +3 -5
  280. package/lib/nav-bar/index.js +6 -19
  281. package/lib/notice-bar/CloseIcon.js +2 -3
  282. package/lib/notice-bar/MenuIcon.js +2 -3
  283. package/lib/notice-bar/NoticeIcon.js +2 -3
  284. package/lib/notice-bar/OpenIcon.js +2 -3
  285. package/lib/notice-bar/TipIcon.js +2 -3
  286. package/lib/notice-bar/WarningIcon.js +2 -3
  287. package/lib/notice-bar/index.js +12 -43
  288. package/lib/number-keyboard/CollapseIcon.js +2 -3
  289. package/lib/number-keyboard/DeleteIcon.js +2 -3
  290. package/lib/number-keyboard/Key.js +4 -20
  291. package/lib/number-keyboard/index.js +6 -29
  292. package/lib/overlay/index.js +6 -18
  293. package/lib/password-input/index.js +11 -25
  294. package/lib/picker/PickerColumn.js +24 -71
  295. package/lib/picker/index.js +14 -59
  296. package/lib/picker/shared.js +3 -5
  297. package/lib/popover/index.js +65 -104
  298. package/lib/popup/index.js +7 -30
  299. package/lib/pull-refresh/index.js +11 -38
  300. package/lib/radio/index.js +4 -10
  301. package/lib/radio-group/index.js +4 -11
  302. package/lib/rate/index.js +13 -34
  303. package/lib/row/index.js +5 -15
  304. package/lib/search/index.js +8 -23
  305. package/lib/signature/bezier.js +14 -25
  306. package/lib/signature/force-landscape.js +5 -19
  307. package/lib/signature/index.js +8 -34
  308. package/lib/signature/point.js +2 -11
  309. package/lib/signature/throttle.js +1 -11
  310. package/lib/skeleton/index.js +6 -23
  311. package/lib/slider/index.js +21 -66
  312. package/lib/step/index.js +7 -21
  313. package/lib/stepper/index.js +12 -49
  314. package/lib/steps/index.js +4 -10
  315. package/lib/sticky/index.js +10 -62
  316. package/lib/swipe/index.js +21 -73
  317. package/lib/swipe-cell/index.js +9 -32
  318. package/lib/swipe-item/index.js +12 -27
  319. package/lib/switch/index.js +9 -17
  320. package/lib/switch/shared.js +3 -4
  321. package/lib/switch-cell/index.js +7 -18
  322. package/lib/tab/index.js +6 -24
  323. package/lib/tabbar/index.js +6 -22
  324. package/lib/tabbar-item/index.js +7 -24
  325. package/lib/table/index.js +7 -38
  326. package/lib/table/type.js +3 -5
  327. package/lib/tabs/Content.js +7 -18
  328. package/lib/tabs/Title.js +13 -27
  329. package/lib/tabs/index.js +17 -68
  330. package/lib/tabs/utils.js +0 -13
  331. package/lib/tag/index.js +13 -25
  332. package/lib/text-ellipsis/index.js +27 -49
  333. package/lib/timeline/index.js +4 -35
  334. package/lib/timeline/svg/current.js +2 -3
  335. package/lib/timeline/svg/pass.js +2 -3
  336. package/lib/toast/Toast.js +12 -33
  337. package/lib/toast/index.js +7 -40
  338. package/lib/toast/lock-click.js +0 -3
  339. package/lib/toast/svg/SuccessIcon.js +2 -3
  340. package/lib/toast/svg/WarnIcon.js +2 -3
  341. package/lib/uploader/index.js +12 -75
  342. package/lib/uploader/utils.js +4 -21
  343. package/lib/utils/constant.js +12 -21
  344. package/lib/utils/create/bem.js +1 -6
  345. package/lib/utils/create/component.js +6 -17
  346. package/lib/utils/create/i18n.js +0 -8
  347. package/lib/utils/create/index.js +0 -4
  348. package/lib/utils/deep-assign.js +0 -6
  349. package/lib/utils/deep-clone.js +0 -5
  350. package/lib/utils/device.js +1 -3
  351. package/lib/utils/dom/event.js +5 -14
  352. package/lib/utils/dom/node.js +0 -2
  353. package/lib/utils/dom/raf.js +9 -13
  354. package/lib/utils/dom/reset-scroll.js +2 -4
  355. package/lib/utils/dom/scroll.js +16 -37
  356. package/lib/utils/dom/style.js +3 -3
  357. package/lib/utils/easings.js +2 -5
  358. package/lib/utils/format/date-util.js +88 -203
  359. package/lib/utils/format/number.js +4 -15
  360. package/lib/utils/format/string.js +0 -5
  361. package/lib/utils/format/unit.js +2 -16
  362. package/lib/utils/functional.js +7 -15
  363. package/lib/utils/getScroll.js +1 -8
  364. package/lib/utils/index.js +10 -26
  365. package/lib/utils/interceptor.js +2 -6
  366. package/lib/utils/media/image-util.js +10 -28
  367. package/lib/utils/raf.js +4 -13
  368. package/lib/utils/router.js +10 -13
  369. package/lib/utils/scrollTo.js +12 -24
  370. package/lib/utils/validate/date.js +0 -2
  371. package/lib/utils/validate/email.js +0 -1
  372. package/lib/utils/validate/mobile.js +0 -1
  373. package/lib/utils/validate/number.js +3 -5
  374. package/lib/utils/validate/system.js +0 -3
  375. package/lib/utils/vnodes.js +2 -9
  376. package/lib/zart.js +3524 -7066
  377. package/lib/zart.min.js +7 -1
  378. package/package.json +1 -1
@@ -1,64 +1,61 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.FORMAT = void 0;
5
+ exports.addDays = addDays;
6
+ exports.addMonths = addMonths;
7
+ exports.addSeconds = addSeconds;
4
8
  exports.formatDate = formatDate;
5
9
  exports.formatDateByDate = formatDateByDate;
6
10
  exports.formatDateByDateByObject = formatDateByDateByObject;
7
- exports.parseDate = parseDate;
8
- exports.getWeek = getWeek;
9
- exports.getTodayWeek = getTodayWeek;
10
- exports.getWeekNum = getWeekNum;
11
- exports.getShortDateDesc = getShortDateDesc;
11
+ exports.formatLeftTime = formatLeftTime;
12
+ exports.getCurMonth = getCurMonth;
13
+ exports.getDateCN = getDateCN;
12
14
  exports.getDateDesc = getDateDesc;
15
+ exports.getDateDiff = getDateDiff;
13
16
  exports.getFirstDayOfNormalMonth = getFirstDayOfNormalMonth;
14
- exports.getWeekNumDefault = getWeekNumDefault;
17
+ exports.getFirstDayOfWeek = getFirstDayOfWeek;
15
18
  exports.getFirstDayOfYear = getFirstDayOfYear;
16
- exports.getLastMonthStartAndEnd = getLastMonthStartAndEnd;
17
- exports.getLastDayOfNormalMonth = getLastDayOfNormalMonth;
18
- exports.subYears = subYears;
19
- exports.subYearsNotModify = subYearsNotModify;
20
- exports.addDays = addDays;
21
- exports.subDays = subDays;
22
- exports.addSeconds = addSeconds;
23
- exports.getToday = getToday;
24
- exports.getTodayCN = getTodayCN;
25
- exports.getDateCN = getDateCN;
26
- exports.getCurMonth = getCurMonth;
27
- exports.operateMonth = operateMonth;
28
19
  exports.getLastDay = getLastDay;
29
- exports.getNextDay = getNextDay;
30
- exports.getYear = getYear;
20
+ exports.getLastDayOfNormalMonth = getLastDayOfNormalMonth;
21
+ exports.getLastMonthStartAndEnd = getLastMonthStartAndEnd;
31
22
  exports.getMonth = getMonth;
23
+ exports.getMonthDays = getMonthDays;
24
+ exports.getMonthWeek = getMonthWeek;
25
+ exports.getNextDay = getNextDay;
32
26
  exports.getPeriodDesc = getPeriodDesc;
27
+ exports.getShortDateDesc = getShortDateDesc;
28
+ exports.getTimeDiff = getTimeDiff;
33
29
  exports.getTimeStrFromRaw = getTimeStrFromRaw;
34
- exports.formatLeftTime = formatLeftTime;
35
30
  exports.getTimeString = getTimeString;
36
- exports.isValidTimeStamp = isValidTimeStamp;
37
- exports.todaySpecialDate = todaySpecialDate;
38
- exports.getTimeDiff = getTimeDiff;
31
+ exports.getToday = getToday;
32
+ exports.getTodayCN = getTodayCN;
33
+ exports.getTodayWeek = getTodayWeek;
34
+ exports.getWeek = getWeek;
35
+ exports.getWeekNum = getWeekNum;
36
+ exports.getWeekNumDefault = getWeekNumDefault;
39
37
  exports.getWeekNumber = getWeekNumber;
40
- exports.isLeapYear = isLeapYear;
41
- exports.getMonthDays = getMonthDays;
42
- exports.getFirstDayOfWeek = getFirstDayOfWeek;
43
- exports.addMonths = addMonths;
44
- exports.getMonthWeek = getMonthWeek;
38
+ exports.getYear = getYear;
45
39
  exports.getYearWeekList = getYearWeekList;
46
40
  exports.getYearWeekListWh = getYearWeekListWh;
41
+ exports.isLeapYear = isLeapYear;
47
42
  exports.isLessThanDate = isLessThanDate;
48
- exports.getDateDiff = getDateDiff;
49
- exports.FORMAT = exports.weekList = void 0;
50
-
43
+ exports.isValidTimeStamp = isValidTimeStamp;
44
+ exports.operateMonth = operateMonth;
45
+ exports.parseDate = parseDate;
46
+ exports.subDays = subDays;
47
+ exports.subYears = subYears;
48
+ exports.subYearsNotModify = subYearsNotModify;
49
+ exports.todaySpecialDate = todaySpecialDate;
50
+ exports.weekList = void 0;
51
51
  var __formatNumber__ = function __formatNumber__(number) {
52
52
  if (number < 10) {
53
53
  return "0" + number;
54
54
  }
55
-
56
55
  return number;
57
56
  };
58
-
59
- var weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
60
- exports.weekList = weekList;
61
- var FORMAT = {
57
+ var weekList = exports.weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
58
+ var FORMAT = exports.FORMAT = {
62
59
  //英文简写如:12:01
63
60
  FORMAT_HM: "HH:mm",
64
61
  //英文简写如:1-12 12:01
@@ -93,47 +90,38 @@ var FORMAT = {
93
90
  //中文全称 如:2010年12月01日 23时15分06秒
94
91
  FORMAT_YMDHMS_CN: "yyyy年MM月dd日 HH时mm分ss秒"
95
92
  };
93
+
96
94
  /**
97
95
  *
98
96
  * @param timestamp 1544580660000
99
97
  * @param formatType
100
98
  */
101
-
102
- exports.FORMAT = FORMAT;
103
-
104
99
  function formatDate(timestamp, formatType) {
105
100
  if (formatType == null) {
106
101
  formatType = "yyyy-MM-dd HH:mm:ss";
107
102
  }
108
-
109
103
  var stamp = parseInt(timestamp, 10);
110
-
111
104
  if (!isNaN(stamp)) {
112
105
  return formatDateByDate(new Date(stamp), formatType);
113
106
  } else {
114
107
  return formatDateByDate(timestamp, formatType);
115
108
  }
116
109
  }
117
-
118
110
  function formatDateByDate(date, formatType) {
119
111
  if (formatType === void 0) {
120
112
  formatType = FORMAT.FORMAT_YMDHMS;
121
113
  }
122
-
123
114
  if (typeof date != 'object') {
124
115
  // IOS5以下无法解析'2018-01-02'这种格式,需要替换为'2018/01/02'
125
116
  if (typeof date === 'string') {
126
117
  date = date.replace(/-/g, '/');
127
-
128
118
  if (date.length === 7) {
129
119
  // 只有月份的日期ios无法解析,例如 2021/06 , 需转换成2021/06/01
130
120
  date += "/01";
131
121
  }
132
122
  }
133
-
134
123
  date = new Date(date);
135
124
  }
136
-
137
125
  var formatResult = formatType.replace("yyyy", __formatNumber__(date.getFullYear()));
138
126
  formatResult = formatResult.replace("yy", String(date.getFullYear()).substring(2));
139
127
  formatResult = formatResult.replace("MM", __formatNumber__(date.getMonth() + 1));
@@ -144,14 +132,11 @@ function formatDateByDate(date, formatType) {
144
132
  formatResult = formatResult.replace("msms", __formatNumber__(date.getMilliseconds()));
145
133
  return formatResult;
146
134
  }
147
-
148
135
  function formatDateByDateByObject(date, formatType) {
149
136
  if (formatType === void 0) {
150
137
  formatType = FORMAT.FORMAT_YMDHMS;
151
138
  }
152
-
153
139
  var formatResult = formatType;
154
-
155
140
  if (typeof date == 'object') {
156
141
  formatResult = formatType.replace("yyyy", __formatNumber__(date.year));
157
142
  formatResult = formatResult.replace("yy", String(date.year).substring(2));
@@ -161,35 +146,26 @@ function formatDateByDateByObject(date, formatType) {
161
146
  formatResult = formatResult.replace("mm", __formatNumber__(date.minute));
162
147
  formatResult = formatResult.replace("ss", __formatNumber__(date.second));
163
148
  }
164
-
165
149
  return formatResult;
166
150
  }
167
-
168
151
  function parseDate(dateStr) {
169
152
  return new Date(Date.parse(dateStr.replace(/-/g, "/")));
170
153
  }
171
-
172
154
  function getWeek(date) {
173
155
  return weekList[date.getDay()];
174
156
  }
175
-
176
157
  function getTodayWeek() {
177
158
  return weekList[new Date().getDay()];
178
159
  }
179
-
180
160
  function getWeekNum(date) {
181
161
  var week = date.getDay();
182
-
183
162
  if (week === 0) {
184
163
  week = 7;
185
164
  }
186
-
187
165
  return week;
188
166
  }
189
-
190
167
  function getShortDateDesc(date) {
191
168
  var hours = date.getHours();
192
-
193
169
  if (hours >= 0 && hours < 6) {
194
170
  return "凌晨" + hours + "点";
195
171
  } else if (hours >= 6 && hours < 12) {
@@ -202,63 +178,54 @@ function getShortDateDesc(date) {
202
178
  return "时间错误";
203
179
  }
204
180
  }
205
-
206
181
  function getDateDesc(date) {
207
182
  var nowTimestamp = new Date().getTime();
208
183
  var timestamp = date.getTime();
209
184
  var diff = nowTimestamp - timestamp;
210
185
  var fix = "前";
211
-
212
186
  if (diff < 0) {
213
187
  fix = "后";
214
- } //月
215
-
188
+ }
216
189
 
190
+ //月
217
191
  var unit = 1000 * 60 * 60 * 24 * 30;
218
-
219
192
  if (diff / unit > 1) {
220
193
  return parseInt(diff / unit, 10) + "个月" + fix;
221
- } //周
222
-
194
+ }
223
195
 
196
+ //周
224
197
  unit = 1000 * 60 * 60 * 24 * 7;
225
-
226
198
  if (diff / unit > 1) {
227
199
  return parseInt(diff / unit, 10) + "周" + fix;
228
- } //日
229
-
200
+ }
230
201
 
202
+ //日
231
203
  unit = 1000 * 60 * 60 * 24;
232
-
233
204
  if (diff / unit > 1) {
234
205
  return parseInt(diff / unit, 10) + "天" + fix;
235
- } //小时
236
-
206
+ }
237
207
 
208
+ //小时
238
209
  unit = 1000 * 60 * 60;
239
-
240
210
  if (diff / unit > 1) {
241
211
  return parseInt(diff / unit, 10) + "个小时" + fix;
242
- } //分钟
243
-
212
+ }
244
213
 
214
+ //分钟
245
215
  unit = 1000 * 60;
246
-
247
216
  if (diff / unit > 1) {
248
217
  return parseInt(diff / unit, 10) + "分钟" + fix;
249
- } //秒
250
-
218
+ }
251
219
 
220
+ //秒
252
221
  unit = 1000;
253
-
254
222
  if (diff / unit > 1) {
255
223
  return "刚刚";
256
224
  }
257
-
258
225
  return formatDate(date.getTime(), FORMAT.FORMAT_YMDHMS);
259
- } //常规月起始日
260
-
226
+ }
261
227
 
228
+ //常规月起始日
262
229
  function getFirstDayOfNormalMonth(year, month) {
263
230
  var date = new Date();
264
231
  date.setDate(1);
@@ -266,43 +233,37 @@ function getFirstDayOfNormalMonth(year, month) {
266
233
  date.setMonth(month - 1);
267
234
  return date;
268
235
  }
269
-
270
236
  function getWeekNumDefault(date) {
271
237
  var week = date.getDay();
272
238
  return week;
273
- } //获取当年起始日期
274
-
239
+ }
275
240
 
241
+ //获取当年起始日期
276
242
  function getFirstDayOfYear(year) {
277
243
  var date = new Date();
278
244
  date.setDate(1);
279
245
  date.setYear(year);
280
246
  date.setMonth(0);
281
247
  return date;
282
- } //获取上月起始日期
283
-
284
-
248
+ }
249
+ //获取上月起始日期
285
250
  function getLastMonthStartAndEnd() {
286
251
  var nowdays = new Date();
287
252
  var year = nowdays.getFullYear();
288
253
  var month = nowdays.getMonth();
289
-
290
254
  if (month === 0) {
291
255
  month = 12;
292
256
  year = year - 1;
293
257
  }
294
-
295
258
  if (month < 10) {
296
259
  month = '0' + month;
297
260
  }
298
-
299
261
  var myDate = new Date(year, month, 0);
300
262
  var startDate = year + '-' + month + '-01';
301
263
  var endDate = year + '-' + month + '-' + myDate.getDate();
302
264
  return startDate + ',' + endDate;
303
- } //常规月结束日
304
-
305
-
265
+ }
266
+ //常规月结束日
306
267
  function getLastDayOfNormalMonth(year, month) {
307
268
  var date = new Date();
308
269
  date.setDate(1);
@@ -310,56 +271,45 @@ function getLastDayOfNormalMonth(year, month) {
310
271
  date.setMonth(month);
311
272
  return new Date(date.getTime() - 1000 * 60 * 60 * 24);
312
273
  }
313
-
314
274
  function subYears(date, years) {
315
275
  var dateYear = date.getFullYear();
316
276
  return new Date(date.setYear(dateYear - years));
317
277
  }
318
-
319
278
  function subYearsNotModify(date, years) {
320
279
  var dateYear = date.getFullYear();
321
280
  return new Date(date).setYear(dateYear - years);
322
281
  }
323
-
324
282
  function addDays(date, days) {
325
283
  return new Date(date.getTime() + days * 1000 * 60 * 60 * 24);
326
284
  }
327
-
328
285
  function subDays(date, days) {
329
286
  return new Date(date.getTime() - days * 1000 * 60 * 60 * 24);
330
287
  }
331
-
332
288
  function addSeconds(date, seconds) {
333
289
  return new Date(date.getTime() + seconds * 1000);
334
290
  }
335
-
336
291
  function getToday() {
337
292
  return formatDateByDate(new Date(), FORMAT.FORMAT_YMD);
338
293
  }
339
-
340
294
  function getTodayCN() {
341
295
  return formatDateByDate(new Date(), FORMAT.FORMAT_YMD_CN);
342
296
  }
343
-
344
297
  function getDateCN(strDate) {
345
298
  if (strDate != null) {
346
299
  var date = parseDate(strDate);
347
300
  return formatDateByDate(date, FORMAT.FORMAT_YMD_CN);
348
301
  }
349
-
350
302
  return null;
351
303
  }
352
-
353
304
  function getCurMonth() {
354
305
  return formatDateByDate(new Date(), FORMAT.FORMAT_YM);
355
- } //strdate 格式为 "2017-03" 或者 "2017-02-23" , opreation : 1 上个月 2 下个月
356
-
306
+ }
357
307
 
308
+ //strdate 格式为 "2017-03" 或者 "2017-02-23" , opreation : 1 上个月 2 下个月
358
309
  function operateMonth(strDate, operation) {
359
310
  var temp = strDate.split("-");
360
311
  var year = parseInt(temp[0], 10);
361
312
  var month = parseInt(temp[1], 10);
362
-
363
313
  if (operation === 1) {
364
314
  // 减 一个月
365
315
  if (month > 1) {
@@ -377,82 +327,65 @@ function operateMonth(strDate, operation) {
377
327
  year += 1;
378
328
  }
379
329
  }
380
-
381
330
  if (month < 10) {
382
331
  return year + "-0" + month;
383
332
  }
384
-
385
333
  return year + "-" + month;
386
334
  }
387
-
388
335
  function getLastDay(strDate, format) {
389
336
  if (format === void 0) {
390
337
  format = FORMAT.FORMAT_YMD;
391
338
  }
392
-
393
339
  if (strDate != null) {
394
340
  var date = parseDate(strDate);
395
341
  var lastDate = addDays(date, -1);
396
342
  return formatDateByDate(lastDate, format);
397
343
  }
398
-
399
344
  return null;
400
345
  }
401
-
402
346
  function getNextDay(strDate, format) {
403
347
  if (format === void 0) {
404
348
  format = FORMAT.FORMAT_YMD;
405
349
  }
406
-
407
350
  var date;
408
-
409
351
  if (typeof strDate == 'object') {
410
352
  date = strDate;
411
353
  } else {
412
354
  date = parseDate(strDate);
413
355
  }
414
-
415
356
  if (date != null) {
416
357
  var lastDate = addDays(date, 1);
417
358
  return formatDateByDate(lastDate, format);
418
359
  }
419
-
420
360
  return null;
421
361
  }
422
-
423
362
  function getYear() {
424
363
  return new Date().getFullYear();
425
364
  }
426
-
427
365
  function getMonth() {
428
366
  return new Date().getMonth() + 1;
429
367
  }
430
-
431
368
  function getPeriodDesc(milliseconds) {
432
369
  var s = parseInt(milliseconds / 1000 % 60, 10);
433
370
  var m = parseInt(milliseconds / 1000 / 60 % 60, 10);
434
371
  var h = parseInt(milliseconds / 1000 / 60 / 60 % 24, 10);
435
372
  var d = parseInt(milliseconds / 1000 / 60 / 60 / 24, 10);
436
373
  var desc = '';
437
-
438
374
  if (d > 0) {
439
375
  desc += d + '天';
440
376
  }
441
-
442
377
  if (h > 0) {
443
378
  desc += h + '小时';
444
379
  }
445
-
446
380
  if (m > 0) {
447
381
  desc += m + '分';
448
382
  }
449
-
450
383
  if (s > 0) {
451
384
  desc += s + '秒';
452
385
  }
453
-
454
386
  return desc;
455
387
  }
388
+
456
389
  /**
457
390
  * 将不规范书写的时间转为规范书写的
458
391
  * 9 09:00:00
@@ -461,47 +394,36 @@ function getPeriodDesc(milliseconds) {
461
394
  * @param rawStr
462
395
  * @returns {*}
463
396
  */
464
-
465
-
466
397
  function getTimeStrFromRaw(rawStr) {
467
398
  var items = rawStr.split(':');
468
-
469
399
  if (items === null) {
470
400
  return '00:00:00';
471
401
  }
472
-
473
402
  var threeItems = [];
474
-
475
403
  if (items.length >= 3) {
476
404
  threeItems = items.slice(0, 3);
477
405
  } else {
478
406
  var addNum = 3 - items.length;
479
407
  threeItems = items;
480
-
481
408
  for (var i = 0; i < addNum; i++) {
482
409
  threeItems.push('00');
483
410
  }
484
411
  }
485
-
486
412
  threeItems = threeItems.map(function (time) {
487
413
  var finedTime = time;
488
-
489
414
  if (time.length === 1) {
490
415
  finedTime = '0' + time;
491
416
  }
492
-
493
417
  return finedTime;
494
418
  });
495
419
  return threeItems.join(':');
496
420
  }
497
-
498
421
  function formatLeftTime(leftTime) {
499
422
  var nd = 24 * 60 * 60;
500
423
  var nh = 60 * 60;
501
424
  var nm = 60;
502
425
  var ns = 1;
503
426
  var seconds = leftTime || 0;
504
-
505
427
  if (seconds < -(3600 * 24)) {
506
428
  seconds = -seconds;
507
429
  return "\u8D85\u65F6" + parseInt(seconds / nd, 10) + "\u5929";
@@ -525,6 +447,7 @@ function formatLeftTime(leftTime) {
525
447
  return null;
526
448
  }
527
449
  }
450
+
528
451
  /**
529
452
  * get human readable time string from time result from server no matter whether it is timestamp or human readable string
530
453
  * dependent on FORMAT and formatDate, "import * as dateUtil from '***'" recommended
@@ -532,63 +455,48 @@ function formatLeftTime(leftTime) {
532
455
  * @param format
533
456
  * @returns {*}
534
457
  */
535
-
536
-
537
458
  function getTimeString(value, format) {
538
459
  if (format === void 0) {
539
460
  format = FORMAT.FORMAT_YMDHMS;
540
461
  }
541
-
542
462
  var stringifiedValue = value + '';
543
-
544
463
  if (stringifiedValue.indexOf(':') !== -1 || stringifiedValue.indexOf(':') !== -1) {
545
464
  return stringifiedValue;
546
465
  }
547
-
548
466
  if (parseInt(stringifiedValue, 10) > 999999999999) {
549
467
  return formatDate(parseInt(stringifiedValue, 10), format);
550
468
  }
551
-
552
469
  return value;
553
470
  }
554
-
555
471
  function isValidTimeStamp(val) {
556
472
  if (!val) {
557
473
  return false;
558
474
  }
559
-
560
475
  if (Object.prototype.toString.call(val) !== '[object Number]') {
561
476
  return false;
562
477
  }
563
-
564
478
  if (val <= 0 || isNaN(val)) {
565
479
  return false;
566
480
  }
567
-
568
481
  if (val < 1000000000000 || val > 10000000000000) {
569
482
  return false;
570
483
  }
571
-
572
484
  return true;
573
485
  }
486
+
574
487
  /**
575
488
  * 将当天时间显示为”X小时前“/”X分钟前“/“X秒前”
576
489
  * 当天之前显示“MM-dd HH:mm”
577
490
  *
578
491
  */
579
-
580
-
581
492
  function todaySpecialDate(time) {
582
493
  time = new Date(time);
583
-
584
494
  if (formatDateByDate(time, FORMAT.FORMAT_YMD) === formatDateByDate(new Date(), FORMAT.FORMAT_YMD)) {
585
495
  var lastHours = new Date().getHours() - new Date(time).getHours();
586
-
587
496
  if (lastHours > 0) {
588
497
  time = lastHours + "\u5C0F\u65F6\u524D";
589
498
  } else {
590
499
  var lastMinutes = new Date().getMinutes() - new Date(time).getMinutes();
591
-
592
500
  if (lastMinutes > 0) {
593
501
  time = lastMinutes + "\u5206\u949F\u524D";
594
502
  } else {
@@ -602,100 +510,84 @@ function todaySpecialDate(time) {
602
510
  time = formatDateByDate(time, FORMAT.FORMAT_YMDHM);
603
511
  }
604
512
  }
605
-
606
513
  return time;
607
- } // 获取日期之间的时间
608
-
514
+ }
609
515
 
516
+ // 获取日期之间的时间
610
517
  function getTimeDiff(firstDate, secondDate) {
611
518
  var result = '';
612
519
  var diff = Math.abs(firstDate.getTime() - secondDate.getTime());
613
520
  var hours = parseInt(diff / (1000 * 60 * 60), 10);
614
521
  var minutes = parseInt((diff - hours * 1000 * 60 * 60) / (1000 * 60), 10);
615
522
  var seconds = parseInt((diff - hours * 1000 * 60 * 60 - minutes * 1000 * 60) / 1000, 10);
616
-
617
523
  if (hours < 10) {
618
524
  result = result + '0' + hours + ':';
619
525
  } else {
620
526
  result = result + hours + ':';
621
527
  }
622
-
623
528
  if (minutes < 10) {
624
529
  result = result + '0' + minutes + ':';
625
530
  } else {
626
531
  result = result + minutes + ':';
627
532
  }
628
-
629
533
  if (seconds < 10) {
630
534
  result = result + '0' + seconds;
631
535
  } else {
632
536
  result = result + seconds;
633
537
  }
634
-
635
538
  return result;
636
539
  }
540
+
637
541
  /**
638
542
  *获取某年某月某天是一年的第几周
639
543
  *第一天为周日
640
544
  */
641
-
642
-
643
545
  function getWeekNumber(date) {
644
546
  var targetDay = new Date(date);
645
547
  var year = targetDay.getFullYear();
646
548
  var month = targetDay.getMonth();
647
- var days = targetDay.getDate(); //那一天是那一年中的第多少天
648
-
549
+ var days = targetDay.getDate();
550
+ //那一天是那一年中的第多少天
649
551
  for (var i = 1; i < month + 1; i++) {
650
552
  days += getMonthDays(year, i);
651
- } //那一年第一天是星期几
652
-
653
-
654
- var yearFirstDay = new Date(year, 0, 1).getDay(); //计算是第几周
655
-
553
+ }
554
+ //那一年第一天是星期几
555
+ var yearFirstDay = new Date(year, 0, 1).getDay();
556
+ //计算是第几周
656
557
  days += yearFirstDay;
657
558
  var week = Math.ceil(days / 7);
658
559
  return week;
659
560
  }
561
+
660
562
  /**
661
563
  *判断年份是否为润年
662
564
  */
663
-
664
-
665
565
  function isLeapYear(year) {
666
566
  return year % 400 == 0 || year % 4 == 0 && year % 100 != 0;
667
567
  }
668
568
  /**
669
569
  *获取某年某月的天数
670
570
  */
671
-
672
-
673
571
  function getMonthDays(year, month) {
674
572
  return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
675
573
  }
676
574
  /**
677
575
  * 获取本周第一天
678
576
  */
679
-
680
-
681
577
  function getFirstDayOfWeek(date) {
682
578
  var target = new Date(date);
683
579
  var weekday = target.getDay() || 7; //获取星期几,getDay()返回值是 0(周日) 到 6(周六) 之间的一个整数。0||7为7,即weekday的值为1-7
684
-
685
580
  return addDays(target, 1 - weekday);
686
581
  }
687
582
  /**
688
583
  * 加减月份
689
584
  */
690
-
691
-
692
585
  function addMonths(date, months) {
693
586
  var target = new Date(date);
694
587
  var y = target.getFullYear();
695
588
  var m = target.getMonth();
696
589
  var d = target.getDate();
697
590
  m = m + months;
698
-
699
591
  if (m < 0) {
700
592
  m = m + 12;
701
593
  y = y - 1;
@@ -703,36 +595,32 @@ function addMonths(date, months) {
703
595
  m = m - 12;
704
596
  y = y + 1;
705
597
  }
706
-
707
598
  return new Date(y, m, d);
708
- } //获取当前天是这个月的第几周
709
-
710
-
599
+ }
600
+ //获取当前天是这个月的第几周
711
601
  function getMonthWeek(date) {
712
602
  var targetDay = new Date(date);
713
603
  var w = targetDay.getDay();
714
604
  var d = targetDay.getDate();
715
-
716
605
  if (w == 0) {
717
606
  w = 7;
718
607
  }
719
-
720
608
  return Math.ceil((d + 6 - w) / 7);
721
609
  }
610
+ ;
722
611
 
723
- ; //获取一年所有周开始日期和结束日期 , 返回 12.26-01.03 01.04-01.11
724
-
612
+ //获取一年所有周开始日期和结束日期 , 返回 12.26-01.03 01.04-01.11
725
613
  function getYearWeekList(year) {
726
614
  //获取当前年份的第一天是周几
727
615
  var firstDay = new Date(year, 0, 1);
728
- var yearFirstDay = firstDay.getDay(); //获取当前年份第一天所在的周的第一天
729
-
730
- var firstWeekFirstDay = subDays(firstDay, yearFirstDay); //获取当前年份最后一天
616
+ var yearFirstDay = firstDay.getDay();
617
+ //获取当前年份第一天所在的周的第一天
618
+ var firstWeekFirstDay = subDays(firstDay, yearFirstDay);
731
619
 
620
+ //获取当前年份最后一天
732
621
  var endDay = subDays(new Date(year + 1, 0, 1), 1);
733
622
  var endWeekDay = firstWeekFirstDay;
734
623
  var weekStrList = [];
735
-
736
624
  while (endWeekDay < endDay) {
737
625
  var first = endWeekDay.getMonth() + 1 + "." + (endWeekDay.getDate() + 1);
738
626
  endWeekDay = addDays(endWeekDay, 7);
@@ -740,24 +628,23 @@ function getYearWeekList(year) {
740
628
  var str = first + "-" + end;
741
629
  weekStrList.push(str);
742
630
  }
743
-
744
631
  console.log("weekStrList :" + JSON.stringify(weekStrList));
745
632
  return weekStrList;
746
633
  }
634
+ ;
747
635
 
748
- ; //武汉环卫获取一年所有周开始日期和结束日期,需要返回上周五到这周四
749
-
636
+ //武汉环卫获取一年所有周开始日期和结束日期,需要返回上周五到这周四
750
637
  function getYearWeekListWh(year) {
751
638
  //获取当前年份的第一天是周几
752
639
  var firstDay = new Date(year, 0, 1);
753
- var yearFirstDay = firstDay.getDay(); //获取当前年份第一天所在的周的第一天
754
-
755
- var firstWeekFirstDay = addDays(subDays(firstDay, yearFirstDay), 4); //获取当前年份最后一天
640
+ var yearFirstDay = firstDay.getDay();
641
+ //获取当前年份第一天所在的周的第一天
642
+ var firstWeekFirstDay = addDays(subDays(firstDay, yearFirstDay), 4);
756
643
 
644
+ //获取当前年份最后一天
757
645
  var endDay = subDays(new Date(year + 1, 0, 1), 1);
758
646
  var endWeekDay = firstWeekFirstDay;
759
647
  var weekStrList = [];
760
-
761
648
  while (endWeekDay < endDay) {
762
649
  var first = endWeekDay.getMonth() + 1 + "." + (endWeekDay.getDate() + 1);
763
650
  endWeekDay = addDays(endWeekDay, 7);
@@ -765,23 +652,21 @@ function getYearWeekListWh(year) {
765
652
  var str = first + "-" + end;
766
653
  weekStrList.push(str);
767
654
  }
768
-
769
655
  console.log("weekStrList :" + JSON.stringify(weekStrList));
770
656
  return weekStrList;
771
657
  }
658
+ ;
772
659
 
773
- ; // 判断开始时间是否小于结束时间
774
-
660
+ // 判断开始时间是否小于结束时间
775
661
  function isLessThanDate(startDateStr, endDateStr) {
776
662
  if (new Date(startDateStr).getTime() > new Date(endDateStr).getTime()) {
777
663
  return false;
778
664
  }
779
-
780
665
  return true;
781
666
  }
667
+ ;
782
668
 
783
- ; // 获取日期之间天数
784
-
669
+ // 获取日期之间天数
785
670
  function getDateDiff(firstDate, secondDate) {
786
671
  var diff = Math.abs(firstDate.getTime() - secondDate.getTime());
787
672
  var dateNum = parseInt(diff / (1000 * 60 * 60 * 24), 10);