uview-ui-wjf 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/changelog.md +388 -0
- package/components/u--form/u--form.vue +92 -0
- package/components/u--image/u--image.vue +73 -0
- package/components/u--input/u--input.vue +115 -0
- package/components/u--text/u--text.vue +72 -0
- package/components/u--textarea/u--textarea.vue +85 -0
- package/components/u-action-sheet/props.js +54 -0
- package/components/u-action-sheet/u-action-sheet.vue +278 -0
- package/components/u-album/props.js +59 -0
- package/components/u-album/u-album.vue +259 -0
- package/components/u-alert/props.js +44 -0
- package/components/u-alert/u-alert.vue +243 -0
- package/components/u-avatar/props.js +78 -0
- package/components/u-avatar/u-avatar.vue +173 -0
- package/components/u-avatar-group/props.js +52 -0
- package/components/u-avatar-group/u-avatar-group.vue +103 -0
- package/components/u-back-top/props.js +54 -0
- package/components/u-back-top/u-back-top.vue +129 -0
- package/components/u-badge/props.js +72 -0
- package/components/u-badge/u-badge.vue +171 -0
- package/components/u-button/nvue.scss +46 -0
- package/components/u-button/props.js +161 -0
- package/components/u-button/u-button.vue +495 -0
- package/components/u-button/vue.scss +80 -0
- package/components/u-calendar/header.vue +99 -0
- package/components/u-calendar/month.vue +579 -0
- package/components/u-calendar/props.js +144 -0
- package/components/u-calendar/u-calendar.vue +384 -0
- package/components/u-calendar/util.js +85 -0
- package/components/u-car-keyboard/props.js +14 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +311 -0
- package/components/u-cell/props.js +110 -0
- package/components/u-cell/u-cell.vue +229 -0
- package/components/u-cell-group/props.js +14 -0
- package/components/u-cell-group/u-cell-group.vue +61 -0
- package/components/u-checkbox/props.js +69 -0
- package/components/u-checkbox/u-checkbox.vue +344 -0
- package/components/u-checkbox-group/props.js +82 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +103 -0
- package/components/u-circle-progress/props.js +8 -0
- package/components/u-circle-progress/u-circle-progress.vue +198 -0
- package/components/u-code/props.js +34 -0
- package/components/u-code/u-code.vue +129 -0
- package/components/u-code-input/props.js +79 -0
- package/components/u-code-input/u-code-input.vue +252 -0
- package/components/u-col/props.js +29 -0
- package/components/u-col/u-col.vue +162 -0
- package/components/u-collapse/props.js +19 -0
- package/components/u-collapse/u-collapse.vue +90 -0
- package/components/u-collapse-item/props.js +59 -0
- package/components/u-collapse-item/u-collapse-item.vue +225 -0
- package/components/u-column-notice/props.js +55 -0
- package/components/u-column-notice/u-column-notice.vue +160 -0
- package/components/u-count-down/props.js +24 -0
- package/components/u-count-down/u-count-down.vue +163 -0
- package/components/u-count-down/utils.js +62 -0
- package/components/u-count-to/props.js +59 -0
- package/components/u-count-to/u-count-to.vue +184 -0
- package/components/u-datetime-picker/props.js +120 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +361 -0
- package/components/u-divider/props.js +44 -0
- package/components/u-divider/u-divider.vue +116 -0
- package/components/u-dropdown/props.js +65 -0
- package/components/u-dropdown/u-dropdown.vue +127 -0
- package/components/u-dropdown-item/props.js +36 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +127 -0
- package/components/u-empty/props.js +59 -0
- package/components/u-empty/u-empty.vue +128 -0
- package/components/u-form/props.js +45 -0
- package/components/u-form/u-form.vue +214 -0
- package/components/u-form-item/props.js +48 -0
- package/components/u-form-item/u-form-item.vue +235 -0
- package/components/u-gap/props.js +24 -0
- package/components/u-gap/u-gap.vue +38 -0
- package/components/u-grid/props.js +19 -0
- package/components/u-grid/u-grid.vue +97 -0
- package/components/u-grid-item/props.js +14 -0
- package/components/u-grid-item/u-grid-item.vue +209 -0
- package/components/u-icon/icons.js +214 -0
- package/components/u-icon/props.js +89 -0
- package/components/u-icon/u-icon.vue +237 -0
- package/components/u-image/props.js +84 -0
- package/components/u-image/u-image.vue +232 -0
- package/components/u-index-anchor/props.js +29 -0
- package/components/u-index-anchor/u-index-anchor.vue +91 -0
- package/components/u-index-item/props.js +5 -0
- package/components/u-index-item/u-index-item.vue +87 -0
- package/components/u-index-list/props.js +29 -0
- package/components/u-index-list/u-index-list.vue +440 -0
- package/components/u-input/props.js +187 -0
- package/components/u-input/u-input.vue +369 -0
- package/components/u-keyboard/props.js +84 -0
- package/components/u-keyboard/u-keyboard.vue +164 -0
- package/components/u-line/props.js +33 -0
- package/components/u-line/u-line.vue +62 -0
- package/components/u-line-progress/props.js +28 -0
- package/components/u-line-progress/u-line-progress.vue +144 -0
- package/components/u-link/props.js +39 -0
- package/components/u-link/u-link.vue +83 -0
- package/components/u-list/props.js +76 -0
- package/components/u-list/u-list.vue +157 -0
- package/components/u-list-item/props.js +9 -0
- package/components/u-list-item/u-list-item.vue +116 -0
- package/components/u-loading-icon/props.js +59 -0
- package/components/u-loading-icon/u-loading-icon.vue +343 -0
- package/components/u-loading-page/props.js +49 -0
- package/components/u-loading-page/u-loading-page.vue +115 -0
- package/components/u-loadmore/props.js +94 -0
- package/components/u-loadmore/u-loadmore.vue +150 -0
- package/components/u-modal/props.js +89 -0
- package/components/u-modal/u-modal.vue +228 -0
- package/components/u-navbar/props.js +84 -0
- package/components/u-navbar/u-navbar.vue +186 -0
- package/components/u-no-network/props.js +19 -0
- package/components/u-no-network/u-no-network.vue +220 -0
- package/components/u-notice-bar/props.js +70 -0
- package/components/u-notice-bar/u-notice-bar.vue +101 -0
- package/components/u-notify/props.js +49 -0
- package/components/u-notify/u-notify.vue +211 -0
- package/components/u-number-box/props.js +109 -0
- package/components/u-number-box/u-number-box.vue +416 -0
- package/components/u-number-keyboard/props.js +19 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +196 -0
- package/components/u-overlay/props.js +24 -0
- package/components/u-overlay/u-overlay.vue +68 -0
- package/components/u-parse/node/node.vue +499 -0
- package/components/u-parse/parser.js +1075 -0
- package/components/u-parse/props.js +45 -0
- package/components/u-parse/u-parse.vue +366 -0
- package/components/u-picker/props.js +79 -0
- package/components/u-picker/u-picker.vue +286 -0
- package/components/u-picker-column/props.js +5 -0
- package/components/u-picker-column/u-picker-column.vue +27 -0
- package/components/u-popup/props.js +79 -0
- package/components/u-popup/u-popup.vue +304 -0
- package/components/u-radio/props.js +64 -0
- package/components/u-radio/u-radio.vue +339 -0
- package/components/u-radio-group/props.js +85 -0
- package/components/u-radio-group/u-radio-group.vue +108 -0
- package/components/u-rate/props.js +69 -0
- package/components/u-rate/u-rate.vue +306 -0
- package/components/u-read-more/props.js +61 -0
- package/components/u-read-more/u-read-more.vue +157 -0
- package/components/u-row/props.js +19 -0
- package/components/u-row/u-row.vue +93 -0
- package/components/u-row-notice/props.js +39 -0
- package/components/u-row-notice/u-row-notice.vue +330 -0
- package/components/u-safe-bottom/props.js +5 -0
- package/components/u-safe-bottom/u-safe-bottom.vue +56 -0
- package/components/u-scroll-list/nvue.js +28 -0
- package/components/u-scroll-list/other.js +0 -0
- package/components/u-scroll-list/props.js +34 -0
- package/components/u-scroll-list/scrollWxs.wxs +50 -0
- package/components/u-scroll-list/u-scroll-list.vue +224 -0
- package/components/u-search/props.js +118 -0
- package/components/u-search/u-search.vue +303 -0
- package/components/u-skeleton/props.js +59 -0
- package/components/u-skeleton/u-skeleton.vue +244 -0
- package/components/u-slider/mpother.js +113 -0
- package/components/u-slider/mpwxs.js +42 -0
- package/components/u-slider/mpwxs.wxs +121 -0
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +180 -0
- package/components/u-slider/nvue.js +193 -0
- package/components/u-slider/props.js +54 -0
- package/components/u-slider/u-slider.vue +55 -0
- package/components/u-status-bar/props.js +8 -0
- package/components/u-status-bar/u-status-bar.vue +46 -0
- package/components/u-steps/props.js +39 -0
- package/components/u-steps/u-steps.vue +80 -0
- package/components/u-steps-item/props.js +24 -0
- package/components/u-steps-item/u-steps-item.vue +316 -0
- package/components/u-sticky/props.js +40 -0
- package/components/u-sticky/u-sticky.vue +212 -0
- package/components/u-subsection/props.js +49 -0
- package/components/u-subsection/u-subsection.vue +299 -0
- package/components/u-swipe-action/props.js +9 -0
- package/components/u-swipe-action/u-swipe-action.vue +67 -0
- package/components/u-swipe-action-item/index - backup.wxs +256 -0
- package/components/u-swipe-action-item/index.wxs +225 -0
- package/components/u-swipe-action-item/nvue - backup.js +270 -0
- package/components/u-swipe-action-item/nvue.js +174 -0
- package/components/u-swipe-action-item/props.js +41 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +190 -0
- package/components/u-swipe-action-item/wxs.js +15 -0
- package/components/u-swiper/props.js +125 -0
- package/components/u-swiper/u-swiper.vue +255 -0
- package/components/u-swiper-indicator/props.js +29 -0
- package/components/u-swiper-indicator/u-swiper-indicator.vue +110 -0
- package/components/u-switch/props.js +54 -0
- package/components/u-switch/u-switch.vue +177 -0
- package/components/u-tabbar/props.js +44 -0
- package/components/u-tabbar/u-tabbar.vue +141 -0
- package/components/u-tabbar-item/props.js +35 -0
- package/components/u-tabbar-item/u-tabbar-item.vue +142 -0
- package/components/u-table/props.js +5 -0
- package/components/u-table/u-table.vue +29 -0
- package/components/u-tabs/props.js +64 -0
- package/components/u-tabs/u-tabs.vue +363 -0
- package/components/u-tabs-item/props.js +5 -0
- package/components/u-tabs-item/u-tabs-item.vue +29 -0
- package/components/u-tag/props.js +84 -0
- package/components/u-tag/u-tag.vue +358 -0
- package/components/u-td/props.js +5 -0
- package/components/u-td/u-td.vue +31 -0
- package/components/u-text/props.js +110 -0
- package/components/u-text/u-text.vue +223 -0
- package/components/u-text/value.js +85 -0
- package/components/u-textarea/props.js +119 -0
- package/components/u-textarea/u-textarea.vue +239 -0
- package/components/u-toast/u-toast.vue +291 -0
- package/components/u-toolbar/props.js +34 -0
- package/components/u-toolbar/u-toolbar.vue +102 -0
- package/components/u-tooltip/clipboard.min.js +58 -0
- package/components/u-tooltip/props.js +59 -0
- package/components/u-tooltip/u-tooltip.vue +366 -0
- package/components/u-tr/props.js +5 -0
- package/components/u-tr/u-tr.vue +31 -0
- package/components/u-transition/nvue.ani-map.js +68 -0
- package/components/u-transition/props.js +24 -0
- package/components/u-transition/transition.js +157 -0
- package/components/u-transition/u-transition.vue +92 -0
- package/components/u-transition/vue.ani-style.scss +113 -0
- package/components/u-upload/mixin.js +21 -0
- package/components/u-upload/props.js +124 -0
- package/components/u-upload/u-upload.vue +566 -0
- package/components/u-upload/utils.js +151 -0
- package/components/uview-ui/uview-ui.vue +15 -0
- package/index.js +79 -0
- package/index.scss +23 -0
- package/libs/config/color.js +17 -0
- package/libs/config/config.js +34 -0
- package/libs/config/props/actionSheet.js +25 -0
- package/libs/config/props/album.js +25 -0
- package/libs/config/props/alert.js +22 -0
- package/libs/config/props/avatar.js +28 -0
- package/libs/config/props/avatarGroup.js +23 -0
- package/libs/config/props/backtop.js +27 -0
- package/libs/config/props/badge.js +27 -0
- package/libs/config/props/button.js +42 -0
- package/libs/config/props/calendar.js +42 -0
- package/libs/config/props/carKeyboard.js +15 -0
- package/libs/config/props/cell.js +35 -0
- package/libs/config/props/cellGroup.js +17 -0
- package/libs/config/props/checkbox.js +27 -0
- package/libs/config/props/checkboxGroup.js +29 -0
- package/libs/config/props/circleProgress.js +15 -0
- package/libs/config/props/code.js +21 -0
- package/libs/config/props/codeInput.js +29 -0
- package/libs/config/props/col.js +19 -0
- package/libs/config/props/collapse.js +17 -0
- package/libs/config/props/collapseItem.js +25 -0
- package/libs/config/props/columnNotice.js +24 -0
- package/libs/config/props/countDown.js +18 -0
- package/libs/config/props/countTo.js +25 -0
- package/libs/config/props/datetimePicker.js +37 -0
- package/libs/config/props/divider.js +23 -0
- package/libs/config/props/empty.js +26 -0
- package/libs/config/props/form.js +22 -0
- package/libs/config/props/formItem.js +23 -0
- package/libs/config/props/gap.js +19 -0
- package/libs/config/props/grid.js +17 -0
- package/libs/config/props/gridItem.js +16 -0
- package/libs/config/props/icon.js +36 -0
- package/libs/config/props/image.js +30 -0
- package/libs/config/props/indexAnchor.js +19 -0
- package/libs/config/props/indexList.js +19 -0
- package/libs/config/props/input.js +48 -0
- package/libs/config/props/keyboard.js +30 -0
- package/libs/config/props/line.js +20 -0
- package/libs/config/props/lineProgress.js +19 -0
- package/libs/config/props/link.js +26 -0
- package/libs/config/props/list.js +28 -0
- package/libs/config/props/listItem.js +15 -0
- package/libs/config/props/loadingIcon.js +30 -0
- package/libs/config/props/loadingPage.js +23 -0
- package/libs/config/props/loadmore.js +32 -0
- package/libs/config/props/modal.js +31 -0
- package/libs/config/props/navbar.js +32 -0
- package/libs/config/props/noNetwork.js +18 -0
- package/libs/config/props/noticeBar.js +27 -0
- package/libs/config/props/notify.js +22 -0
- package/libs/config/props/numberBox.js +35 -0
- package/libs/config/props/numberKeyboard.js +17 -0
- package/libs/config/props/overlay.js +18 -0
- package/libs/config/props/parse.js +22 -0
- package/libs/config/props/picker.js +29 -0
- package/libs/config/props/popup.js +29 -0
- package/libs/config/props/radio.js +27 -0
- package/libs/config/props/radioGroup.js +30 -0
- package/libs/config/props/rate.js +26 -0
- package/libs/config/props/readMore.js +22 -0
- package/libs/config/props/row.js +17 -0
- package/libs/config/props/rowNotice.js +21 -0
- package/libs/config/props/scrollList.js +20 -0
- package/libs/config/props/search.js +37 -0
- package/libs/config/props/section.js +24 -0
- package/libs/config/props/skeleton.js +25 -0
- package/libs/config/props/slider.js +25 -0
- package/libs/config/props/statusBar.js +15 -0
- package/libs/config/props/steps.js +21 -0
- package/libs/config/props/stepsItem.js +18 -0
- package/libs/config/props/sticky.js +20 -0
- package/libs/config/props/subsection.js +23 -0
- package/libs/config/props/swipeAction.js +15 -0
- package/libs/config/props/swipeActionItem.js +21 -0
- package/libs/config/props/swiper.js +39 -0
- package/libs/config/props/swipterIndicator.js +19 -0
- package/libs/config/props/switch.js +24 -0
- package/libs/config/props/tabbar.js +22 -0
- package/libs/config/props/tabbarItem.js +20 -0
- package/libs/config/props/tabs.js +32 -0
- package/libs/config/props/tag.js +29 -0
- package/libs/config/props/text.js +38 -0
- package/libs/config/props/textarea.js +36 -0
- package/libs/config/props/toast.js +30 -0
- package/libs/config/props/toolbar.js +21 -0
- package/libs/config/props/tooltip.js +25 -0
- package/libs/config/props/transition.js +18 -0
- package/libs/config/props/upload.js +36 -0
- package/libs/config/props.js +190 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +97 -0
- package/libs/css/components.scss +15 -0
- package/libs/css/flex.scss +257 -0
- package/libs/css/h5.scss +0 -0
- package/libs/css/mixin.scss +8 -0
- package/libs/css/mp.scss +0 -0
- package/libs/css/nvue.scss +0 -0
- package/libs/css/vue.scss +27 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +731 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +288 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +97 -0
- package/libs/luch-request/core/InterceptorManager.js +50 -0
- package/libs/luch-request/core/Request.js +198 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +29 -0
- package/libs/luch-request/core/dispatchRequest.js +3 -0
- package/libs/luch-request/core/mergeConfig.js +103 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +69 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +116 -0
- package/libs/luch-request/index.js +3 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +131 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +160 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +25 -0
- package/libs/mixin/style.js +228 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/async-validator.js +1343 -0
- package/libs/util/calendar.js +546 -0
- package/libs/util/dayjs.js +308 -0
- package/libs/util/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/package.json +83 -0
- package/theme.scss +44 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @1900-2100区间内的公历、农历互转
|
|
3
|
+
* @charset UTF-8
|
|
4
|
+
* @github https://github.com/jjonline/calendar.js
|
|
5
|
+
* @Author Jea杨(JJonline@JJonline.Cn)
|
|
6
|
+
* @Time 2014-7-21
|
|
7
|
+
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals
|
|
8
|
+
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
|
|
9
|
+
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
|
|
10
|
+
* @Version 1.0.3
|
|
11
|
+
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
|
|
12
|
+
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
|
|
13
|
+
*/
|
|
14
|
+
/* eslint-disable */
|
|
15
|
+
var calendar = {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 农历1900-2100的润大小信息表
|
|
19
|
+
* @Array Of Property
|
|
20
|
+
* @return Hex
|
|
21
|
+
*/
|
|
22
|
+
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
|
|
23
|
+
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
|
|
24
|
+
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
|
|
25
|
+
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
|
|
26
|
+
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
|
|
27
|
+
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
|
|
28
|
+
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
|
|
29
|
+
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
|
|
30
|
+
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
|
|
31
|
+
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
|
|
32
|
+
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
|
|
33
|
+
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
|
|
34
|
+
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
|
|
35
|
+
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
|
|
36
|
+
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
|
|
37
|
+
/** Add By JJonline@JJonline.Cn**/
|
|
38
|
+
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
|
|
39
|
+
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
|
|
40
|
+
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
|
|
41
|
+
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
|
|
42
|
+
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
|
|
43
|
+
0x0d520], // 2100
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 公历每个月份的天数普通表
|
|
47
|
+
* @Array Of Property
|
|
48
|
+
* @return Number
|
|
49
|
+
*/
|
|
50
|
+
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 天干地支之天干速查表
|
|
54
|
+
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
|
|
55
|
+
* @return Cn string
|
|
56
|
+
*/
|
|
57
|
+
Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'],
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 天干地支之地支速查表
|
|
61
|
+
* @Array Of Property
|
|
62
|
+
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
|
|
63
|
+
* @return Cn string
|
|
64
|
+
*/
|
|
65
|
+
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'],
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 天干地支之地支速查表<=>生肖
|
|
69
|
+
* @Array Of Property
|
|
70
|
+
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
|
|
71
|
+
* @return Cn string
|
|
72
|
+
*/
|
|
73
|
+
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'],
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 24节气速查表
|
|
77
|
+
* @Array Of Property
|
|
78
|
+
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
|
|
79
|
+
* @return Cn string
|
|
80
|
+
*/
|
|
81
|
+
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'],
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 1900-2100各年的24节气日期速查表
|
|
85
|
+
* @Array Of Property
|
|
86
|
+
* @return 0x string For splice
|
|
87
|
+
*/
|
|
88
|
+
sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
|
|
89
|
+
'97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
|
90
|
+
'97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
|
|
91
|
+
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
|
|
92
|
+
'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
|
|
93
|
+
'97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
|
|
94
|
+
'97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
|
|
95
|
+
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
|
|
96
|
+
'97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
|
97
|
+
'97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
98
|
+
'97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
|
|
99
|
+
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
|
|
100
|
+
'97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
|
101
|
+
'97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
102
|
+
'97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
|
|
103
|
+
'9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
|
|
104
|
+
'97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
|
|
105
|
+
'97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
|
|
106
|
+
'9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
|
|
107
|
+
'7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
|
108
|
+
'97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
109
|
+
'97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
|
110
|
+
'9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
|
|
111
|
+
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
|
|
112
|
+
'97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
113
|
+
'97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
|
114
|
+
'9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
|
|
115
|
+
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
|
|
116
|
+
'97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
|
|
117
|
+
'9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
|
|
118
|
+
'7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
|
|
119
|
+
'7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
120
|
+
'97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
|
121
|
+
'9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
|
122
|
+
'7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
|
|
123
|
+
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
|
|
124
|
+
'97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
|
125
|
+
'9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
|
126
|
+
'7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
|
|
127
|
+
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
|
|
128
|
+
'977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
|
|
129
|
+
'7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
|
130
|
+
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
|
|
131
|
+
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
|
|
132
|
+
'977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
|
133
|
+
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
|
134
|
+
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
|
|
135
|
+
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
|
|
136
|
+
'977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
|
137
|
+
'7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
|
|
138
|
+
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
|
|
139
|
+
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
|
|
140
|
+
'7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
|
141
|
+
'7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
|
|
142
|
+
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
|
|
143
|
+
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
|
|
144
|
+
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
|
|
145
|
+
'7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
|
|
146
|
+
'7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
|
|
147
|
+
'7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
|
|
148
|
+
'7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
|
|
149
|
+
'7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
|
|
150
|
+
'7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
|
|
151
|
+
'665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
|
|
152
|
+
'7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
|
|
153
|
+
'7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
|
|
154
|
+
'7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'],
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 数字转中文速查表
|
|
158
|
+
* @Array Of Property
|
|
159
|
+
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
|
|
160
|
+
* @return Cn string
|
|
161
|
+
*/
|
|
162
|
+
nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'],
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 日期转农历称呼速查表
|
|
166
|
+
* @Array Of Property
|
|
167
|
+
* @trans ['初','十','廿','卅']
|
|
168
|
+
* @return Cn string
|
|
169
|
+
*/
|
|
170
|
+
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'],
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 月份转农历称呼速查表
|
|
174
|
+
* @Array Of Property
|
|
175
|
+
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
|
|
176
|
+
* @return Cn string
|
|
177
|
+
*/
|
|
178
|
+
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'],
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 返回农历y年一整年的总天数
|
|
182
|
+
* @param lunar Year
|
|
183
|
+
* @return Number
|
|
184
|
+
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
|
185
|
+
*/
|
|
186
|
+
lYearDays: function (y) {
|
|
187
|
+
var i; var sum = 348
|
|
188
|
+
for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 }
|
|
189
|
+
return (sum + this.leapDays(y))
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
|
|
194
|
+
* @param lunar Year
|
|
195
|
+
* @return Number (0-12)
|
|
196
|
+
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
|
|
197
|
+
*/
|
|
198
|
+
leapMonth: function (y) { // 闰字编码 \u95f0
|
|
199
|
+
return (this.lunarInfo[y - 1900] & 0xf)
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 返回农历y年闰月的天数 若该年没有闰月则返回0
|
|
204
|
+
* @param lunar Year
|
|
205
|
+
* @return Number (0、29、30)
|
|
206
|
+
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
|
|
207
|
+
*/
|
|
208
|
+
leapDays: function (y) {
|
|
209
|
+
if (this.leapMonth(y)) {
|
|
210
|
+
return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
|
|
211
|
+
}
|
|
212
|
+
return (0)
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
|
|
217
|
+
* @param lunar Year
|
|
218
|
+
* @return Number (-1、29、30)
|
|
219
|
+
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
|
|
220
|
+
*/
|
|
221
|
+
monthDays: function (y, m) {
|
|
222
|
+
if (m > 12 || m < 1) { return -1 }// 月份参数从1至12,参数错误返回-1
|
|
223
|
+
return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* 返回公历(!)y年m月的天数
|
|
228
|
+
* @param solar Year
|
|
229
|
+
* @return Number (-1、28、29、30、31)
|
|
230
|
+
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
|
|
231
|
+
*/
|
|
232
|
+
solarDays: function (y, m) {
|
|
233
|
+
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
|
234
|
+
var ms = m - 1
|
|
235
|
+
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
|
|
236
|
+
return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28)
|
|
237
|
+
} else {
|
|
238
|
+
return (this.solarMonth[ms])
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 农历年份转换为干支纪年
|
|
244
|
+
* @param lYear 农历年的年份数
|
|
245
|
+
* @return Cn string
|
|
246
|
+
*/
|
|
247
|
+
toGanZhiYear: function (lYear) {
|
|
248
|
+
var ganKey = (lYear - 3) % 10
|
|
249
|
+
var zhiKey = (lYear - 3) % 12
|
|
250
|
+
if (ganKey == 0) ganKey = 10// 如果余数为0则为最后一个天干
|
|
251
|
+
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支
|
|
252
|
+
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 公历月、日判断所属星座
|
|
257
|
+
* @param cMonth [description]
|
|
258
|
+
* @param cDay [description]
|
|
259
|
+
* @return Cn string
|
|
260
|
+
*/
|
|
261
|
+
toAstro: function (cMonth, cDay) {
|
|
262
|
+
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
|
|
263
|
+
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
|
|
264
|
+
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 座
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* 传入offset偏移量返回干支
|
|
269
|
+
* @param offset 相对甲子的偏移量
|
|
270
|
+
* @return Cn string
|
|
271
|
+
*/
|
|
272
|
+
toGanZhi: function (offset) {
|
|
273
|
+
return this.Gan[offset % 10] + this.Zhi[offset % 12]
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 传入公历(!)y年获得该年第n个节气的公历日期
|
|
278
|
+
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
|
|
279
|
+
* @return day Number
|
|
280
|
+
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
|
|
281
|
+
*/
|
|
282
|
+
getTerm: function (y, n) {
|
|
283
|
+
if (y < 1900 || y > 2100) { return -1 }
|
|
284
|
+
if (n < 1 || n > 24) { return -1 }
|
|
285
|
+
var _table = this.sTermInfo[y - 1900]
|
|
286
|
+
var _info = [
|
|
287
|
+
parseInt('0x' + _table.substr(0, 5)).toString(),
|
|
288
|
+
parseInt('0x' + _table.substr(5, 5)).toString(),
|
|
289
|
+
parseInt('0x' + _table.substr(10, 5)).toString(),
|
|
290
|
+
parseInt('0x' + _table.substr(15, 5)).toString(),
|
|
291
|
+
parseInt('0x' + _table.substr(20, 5)).toString(),
|
|
292
|
+
parseInt('0x' + _table.substr(25, 5)).toString()
|
|
293
|
+
]
|
|
294
|
+
var _calday = [
|
|
295
|
+
_info[0].substr(0, 1),
|
|
296
|
+
_info[0].substr(1, 2),
|
|
297
|
+
_info[0].substr(3, 1),
|
|
298
|
+
_info[0].substr(4, 2),
|
|
299
|
+
|
|
300
|
+
_info[1].substr(0, 1),
|
|
301
|
+
_info[1].substr(1, 2),
|
|
302
|
+
_info[1].substr(3, 1),
|
|
303
|
+
_info[1].substr(4, 2),
|
|
304
|
+
|
|
305
|
+
_info[2].substr(0, 1),
|
|
306
|
+
_info[2].substr(1, 2),
|
|
307
|
+
_info[2].substr(3, 1),
|
|
308
|
+
_info[2].substr(4, 2),
|
|
309
|
+
|
|
310
|
+
_info[3].substr(0, 1),
|
|
311
|
+
_info[3].substr(1, 2),
|
|
312
|
+
_info[3].substr(3, 1),
|
|
313
|
+
_info[3].substr(4, 2),
|
|
314
|
+
|
|
315
|
+
_info[4].substr(0, 1),
|
|
316
|
+
_info[4].substr(1, 2),
|
|
317
|
+
_info[4].substr(3, 1),
|
|
318
|
+
_info[4].substr(4, 2),
|
|
319
|
+
|
|
320
|
+
_info[5].substr(0, 1),
|
|
321
|
+
_info[5].substr(1, 2),
|
|
322
|
+
_info[5].substr(3, 1),
|
|
323
|
+
_info[5].substr(4, 2)
|
|
324
|
+
]
|
|
325
|
+
return parseInt(_calday[n - 1])
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 传入农历数字月份返回汉语通俗表示法
|
|
330
|
+
* @param lunar month
|
|
331
|
+
* @return Cn string
|
|
332
|
+
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
|
|
333
|
+
*/
|
|
334
|
+
toChinaMonth: function (m) { // 月 => \u6708
|
|
335
|
+
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
|
336
|
+
var s = this.nStr3[m - 1]
|
|
337
|
+
s += '\u6708'// 加上月字
|
|
338
|
+
return s
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 传入农历日期数字返回汉字表示法
|
|
343
|
+
* @param lunar day
|
|
344
|
+
* @return Cn string
|
|
345
|
+
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
|
346
|
+
*/
|
|
347
|
+
toChinaDay: function (d) { // 日 => \u65e5
|
|
348
|
+
var s
|
|
349
|
+
switch (d) {
|
|
350
|
+
case 10:
|
|
351
|
+
s = '\u521d\u5341'; break
|
|
352
|
+
case 20:
|
|
353
|
+
s = '\u4e8c\u5341'; break
|
|
354
|
+
break
|
|
355
|
+
case 30:
|
|
356
|
+
s = '\u4e09\u5341'; break
|
|
357
|
+
break
|
|
358
|
+
default:
|
|
359
|
+
s = this.nStr2[Math.floor(d / 10)]
|
|
360
|
+
s += this.nStr1[d % 10]
|
|
361
|
+
}
|
|
362
|
+
return (s)
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
|
|
367
|
+
* @param y year
|
|
368
|
+
* @return Cn string
|
|
369
|
+
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
|
|
370
|
+
*/
|
|
371
|
+
getAnimal: function (y) {
|
|
372
|
+
return this.Animals[(y - 4) % 12]
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
|
|
377
|
+
* @param y solar year
|
|
378
|
+
* @param m solar month
|
|
379
|
+
* @param d solar day
|
|
380
|
+
* @return JSON object
|
|
381
|
+
* @eg:console.log(calendar.solar2lunar(1987,11,01));
|
|
382
|
+
*/
|
|
383
|
+
solar2lunar: function (y, m, d) { // 参数区间1900.1.31~2100.12.31
|
|
384
|
+
// 年份限定、上限
|
|
385
|
+
if (y < 1900 || y > 2100) {
|
|
386
|
+
return -1// undefined转换为数字变为NaN
|
|
387
|
+
}
|
|
388
|
+
// 公历传参最下限
|
|
389
|
+
if (y == 1900 && m == 1 && d < 31) {
|
|
390
|
+
return -1
|
|
391
|
+
}
|
|
392
|
+
// 未传参 获得当天
|
|
393
|
+
if (!y) {
|
|
394
|
+
var objDate = new Date()
|
|
395
|
+
} else {
|
|
396
|
+
var objDate = new Date(y, parseInt(m) - 1, d)
|
|
397
|
+
}
|
|
398
|
+
var i; var leap = 0; var temp = 0
|
|
399
|
+
// 修正ymd参数
|
|
400
|
+
var y = objDate.getFullYear()
|
|
401
|
+
var m = objDate.getMonth() + 1
|
|
402
|
+
var d = objDate.getDate()
|
|
403
|
+
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000
|
|
404
|
+
for (i = 1900; i < 2101 && offset > 0; i++) {
|
|
405
|
+
temp = this.lYearDays(i)
|
|
406
|
+
offset -= temp
|
|
407
|
+
}
|
|
408
|
+
if (offset < 0) {
|
|
409
|
+
offset += temp; i--
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// 是否今天
|
|
413
|
+
var isTodayObj = new Date()
|
|
414
|
+
var isToday = false
|
|
415
|
+
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
|
|
416
|
+
isToday = true
|
|
417
|
+
}
|
|
418
|
+
// 星期几
|
|
419
|
+
var nWeek = objDate.getDay()
|
|
420
|
+
var cWeek = this.nStr1[nWeek]
|
|
421
|
+
// 数字表示周几顺应天朝周一开始的惯例
|
|
422
|
+
if (nWeek == 0) {
|
|
423
|
+
nWeek = 7
|
|
424
|
+
}
|
|
425
|
+
// 农历年
|
|
426
|
+
var year = i
|
|
427
|
+
var leap = this.leapMonth(i) // 闰哪个月
|
|
428
|
+
var isLeap = false
|
|
429
|
+
|
|
430
|
+
// 效验闰月
|
|
431
|
+
for (i = 1; i < 13 && offset > 0; i++) {
|
|
432
|
+
// 闰月
|
|
433
|
+
if (leap > 0 && i == (leap + 1) && isLeap == false) {
|
|
434
|
+
--i
|
|
435
|
+
isLeap = true; temp = this.leapDays(year) // 计算农历闰月天数
|
|
436
|
+
} else {
|
|
437
|
+
temp = this.monthDays(year, i)// 计算农历普通月天数
|
|
438
|
+
}
|
|
439
|
+
// 解除闰月
|
|
440
|
+
if (isLeap == true && i == (leap + 1)) { isLeap = false }
|
|
441
|
+
offset -= temp
|
|
442
|
+
}
|
|
443
|
+
// 闰月导致数组下标重叠取反
|
|
444
|
+
if (offset == 0 && leap > 0 && i == leap + 1) {
|
|
445
|
+
if (isLeap) {
|
|
446
|
+
isLeap = false
|
|
447
|
+
} else {
|
|
448
|
+
isLeap = true; --i
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (offset < 0) {
|
|
452
|
+
offset += temp; --i
|
|
453
|
+
}
|
|
454
|
+
// 农历月
|
|
455
|
+
var month = i
|
|
456
|
+
// 农历日
|
|
457
|
+
var day = offset + 1
|
|
458
|
+
// 天干地支处理
|
|
459
|
+
var sm = m - 1
|
|
460
|
+
var gzY = this.toGanZhiYear(year)
|
|
461
|
+
|
|
462
|
+
// 当月的两个节气
|
|
463
|
+
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
|
|
464
|
+
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始
|
|
465
|
+
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始
|
|
466
|
+
|
|
467
|
+
// 依据12节气修正干支月
|
|
468
|
+
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11)
|
|
469
|
+
if (d >= firstNode) {
|
|
470
|
+
gzM = this.toGanZhi((y - 1900) * 12 + m + 12)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// 传入的日期的节气与否
|
|
474
|
+
var isTerm = false
|
|
475
|
+
var Term = null
|
|
476
|
+
if (firstNode == d) {
|
|
477
|
+
isTerm = true
|
|
478
|
+
Term = this.solarTerm[m * 2 - 2]
|
|
479
|
+
}
|
|
480
|
+
if (secondNode == d) {
|
|
481
|
+
isTerm = true
|
|
482
|
+
Term = this.solarTerm[m * 2 - 1]
|
|
483
|
+
}
|
|
484
|
+
// 日柱 当月一日与 1900/1/1 相差天数
|
|
485
|
+
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
|
|
486
|
+
var gzD = this.toGanZhi(dayCyclical + d - 1)
|
|
487
|
+
// 该日期所属的星座
|
|
488
|
+
var astro = this.toAstro(m, d)
|
|
489
|
+
|
|
490
|
+
return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro }
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
|
|
495
|
+
* @param y lunar year
|
|
496
|
+
* @param m lunar month
|
|
497
|
+
* @param d lunar day
|
|
498
|
+
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
|
|
499
|
+
* @return JSON object
|
|
500
|
+
* @eg:console.log(calendar.lunar2solar(1987,9,10));
|
|
501
|
+
*/
|
|
502
|
+
lunar2solar: function (y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
|
|
503
|
+
var isLeapMonth = !!isLeapMonth
|
|
504
|
+
var leapOffset = 0
|
|
505
|
+
var leapMonth = this.leapMonth(y)
|
|
506
|
+
var leapDay = this.leapDays(y)
|
|
507
|
+
if (isLeapMonth && (leapMonth != m)) { return -1 }// 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
|
|
508
|
+
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 超出了最大极限值
|
|
509
|
+
var day = this.monthDays(y, m)
|
|
510
|
+
var _day = day
|
|
511
|
+
// bugFix 2016-9-25
|
|
512
|
+
// if month is leap, _day use leapDays method
|
|
513
|
+
if (isLeapMonth) {
|
|
514
|
+
_day = this.leapDays(y, m)
|
|
515
|
+
}
|
|
516
|
+
if (y < 1900 || y > 2100 || d > _day) { return -1 }// 参数合法性效验
|
|
517
|
+
|
|
518
|
+
// 计算农历的时间差
|
|
519
|
+
var offset = 0
|
|
520
|
+
for (var i = 1900; i < y; i++) {
|
|
521
|
+
offset += this.lYearDays(i)
|
|
522
|
+
}
|
|
523
|
+
var leap = 0; var isAdd = false
|
|
524
|
+
for (var i = 1; i < m; i++) {
|
|
525
|
+
leap = this.leapMonth(y)
|
|
526
|
+
if (!isAdd) { // 处理闰月
|
|
527
|
+
if (leap <= i && leap > 0) {
|
|
528
|
+
offset += this.leapDays(y); isAdd = true
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
offset += this.monthDays(y, i)
|
|
532
|
+
}
|
|
533
|
+
// 转换闰月农历 需补充该年闰月的前一个月的时差
|
|
534
|
+
if (isLeapMonth) { offset += day }
|
|
535
|
+
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
|
|
536
|
+
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
|
|
537
|
+
var calObj = new Date((offset + d - 31) * 86400000 + stmap)
|
|
538
|
+
var cY = calObj.getUTCFullYear()
|
|
539
|
+
var cM = calObj.getUTCMonth() + 1
|
|
540
|
+
var cD = calObj.getUTCDate()
|
|
541
|
+
|
|
542
|
+
return this.solar2lunar(cY, cM, cD)
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export default calendar
|