├── config
├── prod.env.js
├── dev.env.js
└── index.js
├── .eslintignore
├── example
├── common
│ └── stylus
│ │ ├── index.styl
│ │ ├── reset.styl
│ │ └── base.styl
├── main.js
├── index.html
└── App.vue
├── .gitignore
├── postcss.config.js
├── .editorconfig
├── .npmignore
├── src
├── index.js
├── utils
│ ├── utils.js
│ └── date-utils.js
└── vue-better-calendar.vue
├── .babelrc
├── .eslintrc.js
├── LICENSE
├── package.json
├── README.md
└── dist
└── vue-better-calendar.min.js
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | build/*.js
2 | node_modules/*.js
3 | demo/*.js
4 | webpack.*.js
5 |
--------------------------------------------------------------------------------
/example/common/stylus/index.styl:
--------------------------------------------------------------------------------
1 | @require './reset.styl'
2 | @require './base.styl'
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .bin/
2 | node_modules/
3 | .idea/
4 | .DS_Store
5 | .npm-debug.log
6 | coverage/
7 | package-lock.json
8 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | require('autoprefixer')({
4 | browsers: require('./package.json').browserslist
5 | })
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | const merge = require('webpack-merge')
2 | const prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | build/
2 | config/
3 | docs/
4 | doc/
5 | example/
6 | static/
7 | demos/
8 | .idea/
9 | .github/
10 | postcss.config.js
11 | .bin/
12 | .DS_Store
13 | .npm-debug.log
14 | .babelrc
15 | .npmignore
16 | .editorconfig
17 | .eslintrc.js
18 |
--------------------------------------------------------------------------------
/example/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 |
4 | import 'example/common/stylus/index.styl'
5 |
6 | import Calendar from '../src'
7 |
8 | Vue.use(Calendar)
9 |
10 | /* eslint-disable no-new */
11 | new Vue({
12 | el: '#app',
13 | render: h => h(App)
14 | })
15 |
--------------------------------------------------------------------------------
/example/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vue-better-calendar
6 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import Calendar from './vue-better-calendar'
2 |
3 | /* eslint-disable no-undef */
4 | Calendar.version = __VERSION__
5 |
6 | Calendar.install = function(Vue) {
7 | Vue.component(Calendar.name, Calendar)
8 | }
9 |
10 | if (typeof window !== 'undefined' && window.Vue) {
11 | window.Vue.use(Calendar)
12 | }
13 |
14 | export default Calendar
15 |
--------------------------------------------------------------------------------
/src/utils/utils.js:
--------------------------------------------------------------------------------
1 | // 对数字字符串进行补0操作
2 | export function pad(num, n = 2, str = '0') {
3 | let len = num.toString().length
4 | while (len < n) {
5 | num = str + num
6 | len++
7 | }
8 | return num
9 | }
10 |
11 | export function isValidColor(value) {
12 | const colorReg = /^#([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?$/
13 | const rgbaReg = /^[rR][gG][bB][aA]\(\s*((25[0-5]|2[0-4]\d|1?\d{1,2})\s*,\s*){3}\s*(\.|\d+\.)?\d+\s*\)$/
14 | const rgbReg = /^[rR][gG][bB]\(\s*((25[0-5]|2[0-4]\d|1?\d{1,2})\s*,\s*){2}(25[0-5]|2[0-4]\d|1?\d{1,2})\s*\)$/
15 | return colorReg.test(value) || rgbaReg.test(value) || rgbReg.test(value)
16 | }
17 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": [
7 | "> 1%",
8 | "last 2 versions",
9 | "not ie <= 20",
10 | "not ie_mob <= 100",
11 | "not ff <= 100",
12 | "not and_ff <= 100",
13 | "not Edge <= 100",
14 | "Android >= 4.0",
15 | "iOS >= 7.0"
16 | ]
17 | }
18 | }],
19 | "stage-2"
20 | ],
21 | "plugins": ["transform-runtime", "add-module-exports", "transform-es2015-modules-umd"],
22 | "comments": false,
23 | "env": {
24 | "test": {
25 | "presets": ["env", "stage-2"],
26 | "plugins": [ "istanbul" ]
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parser: 'babel-eslint',
6 | parserOptions: {
7 | sourceType: 'module'
8 | },
9 | env: {
10 | browser: true,
11 | },
12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
13 | extends: 'standard',
14 | // required to lint *.vue files
15 | plugins: [
16 | 'html'
17 | ],
18 | // add your custom rules here
19 | rules: {
20 | // allow async-await
21 | 'generator-star-spacing': 'off',
22 | // allow debugger during development
23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
24 | 'no-tabs': 0,
25 | 'indent': 0,
26 | 'space-before-function-paren': 0,
27 | 'eol-last': 0,
28 | 'no-unused-vars': 0,
29 | 'no-undef':0
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 vuer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/example/common/stylus/reset.styl:
--------------------------------------------------------------------------------
1 | /**
2 | * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
3 | * http://cssreset.com
4 | */
5 | html, body, div, span, applet, object, iframe,
6 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
7 | a, abbr, acronym, address, big, cite, code,
8 | del, dfn, em, img, ins, kbd, q, s, samp,
9 | small, strike, strong, sub, sup, tt, var,
10 | b, u, i, center,
11 | dl, dt, dd, ol, ul, li,
12 | fieldset, form, label, legend,
13 | table, caption, tbody, tfoot, thead, tr, th, td,
14 | article, aside, canvas, details, embed,
15 | figure, figcaption, footer, header,
16 | menu, nav, output, ruby, section, summary,
17 | time, mark, audio, video, input
18 | margin: 0
19 | padding: 0
20 | border: 0
21 | font-size: 100%
22 | font-weight: normal
23 | vertical-align: baseline
24 |
25 | /* HTML5 display-role reset for older browsers */
26 | article, aside, details, figcaption, figure,
27 | footer, header, menu, nav, section
28 | display: block
29 |
30 | body
31 | line-height: 1
32 |
33 | blockquote, q
34 | quotes: none
35 |
36 | blockquote:before, blockquote:after,
37 | q:before, q:after
38 | content: none
39 |
40 | table
41 | border-collapse: collapse
42 | border-spacing: 0
43 |
44 | /* custom */
45 |
46 | a
47 | color: #7e8c8d
48 | -webkit-backface-visibility: hidden
49 | text-decoration: none
50 |
51 | li
52 | list-style: none
53 |
54 | body
55 | -webkit-text-size-adjust: none
56 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0)
57 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | const path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | assetsRoot: path.resolve(__dirname, '../dist'),
8 | assetsSubDirectory: '',
9 | assetsPublicPath: './',
10 | productionSourceMap: false,
11 | // Gzip off by default as many popular static hosts such as
12 | // Surge or Netlify already gzip all static assets for you.
13 | // Before setting to `true`, make sure to:
14 | // npm install --save-dev compression-webpack-plugin
15 | productionGzip: false,
16 | productionGzipExtensions: ['js', 'css'],
17 | // Set to `true` or `false` to always turn it on or off
18 | bundleAnalyzerReport: process.env.npm_config_report
19 | },
20 | dev: {
21 | env: require('./dev.env'),
22 | port: 3003,
23 | autoOpenBrowser: true,
24 | assetsSubDirectory: '',
25 | assetsPublicPath: '/',
26 | proxyTable: {},
27 | // CSS Sourcemaps off by default because relative paths are "buggy"
28 | // with this option, according to the CSS-Loader README
29 | // (https://github.com/webpack/css-loader#sourcemaps)
30 | // In our experience, they generally work as expected,
31 | // just be aware of this issue when enabling this option.
32 | cssSourceMap: false
33 | },
34 | demoBuild: {
35 | entry: {
36 | app: './example/main.js'
37 | },
38 | assetsRoot: path.resolve(__dirname, '../demos'),
39 | assetsSubDirectory: ''
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/example/common/stylus/base.styl:
--------------------------------------------------------------------------------
1 | //// row line
2 | $color-row-line = #ccc
3 | //// column line
4 | $color-col-line = #ccc
5 |
6 | .clear-fix
7 | &::after
8 | content: ""
9 | display: table
10 | clear: both
11 |
12 | .border-top-1px, .border-right-1px, .border-bottom-1px, .border-left-1px
13 | position: relative
14 | &::before, &::after
15 | content: ""
16 | display: block
17 | position: absolute
18 | transform-origin: 0 0
19 |
20 | .border-top-1px
21 | &::before
22 | border-top: 1px solid $color-row-line
23 | left: 0
24 | top: 0
25 | width: 100%
26 | transform-origin: 0 top
27 |
28 | .border-right-1px
29 | &::after
30 | border-right: 1px solid $color-col-line
31 | top: 0
32 | right: 0
33 | height: 100%
34 | transform-origin: right 0
35 |
36 | .border-bottom-1px
37 | &::after
38 | border-bottom: 1px solid $color-row-line
39 | left: 0
40 | bottom: 0
41 | width: 100%
42 | transform-origin: 0 bottom
43 |
44 | .border-left-1px
45 | &::before
46 | border-left: 1px solid $color-col-line
47 | top: 0
48 | left: 0
49 | height: 100%
50 | transform-origin: left 0
51 |
52 | @media (min-resolution: 2dppx)
53 | .border-top-1px
54 | &::before
55 | width: 200%
56 | transform: scale(.5) translateZ(0)
57 | .border-right-1px
58 | &::after
59 | height: 200%
60 | transform: scale(.5) translateZ(0)
61 | .border-bottom-1px
62 | &::after
63 | width: 200%
64 | transform: scale(.5) translateZ(0)
65 | .border-left-1px
66 | &::before
67 | height: 200%
68 | transform: scale(.5) translateZ(0)
69 |
70 | @media (min-resolution: 3dppx)
71 | .border-top-1px
72 | &::before
73 | width: 300%
74 | transform: scale(.333) translateZ(0)
75 | .border-right-1px
76 | &::after
77 | height: 300%
78 | transform: scale(.333) translateZ(0)
79 | .border-bottom-1px
80 | &::after
81 | width: 300%
82 | transform: scale(.333) translateZ(0)
83 | .border-left-1px
84 | &::before
85 | height: 300%
86 | transform: scale(.333) translateZ(0)
87 |
--------------------------------------------------------------------------------
/example/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
54 |
55 |
63 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-better-calendar",
3 | "version": "1.3.2",
4 | "description": "A calendar component for vuejs.",
5 | "author": {
6 | "name": "Xiao Wenpeng",
7 | "email": "xwpjava@126.com"
8 | },
9 | "main": "dist/vue-better-calendar.js",
10 | "bugs": {
11 | "url": "https://github.com/xwpongithub/vue-better-calendar/issues"
12 | },
13 | "homepage": "https://github.com/xwpongithub/vue-better-calendar",
14 | "keywords": [
15 | "calendar",
16 | "javascript"
17 | ],
18 | "licenses": "MIT",
19 | "repository": {
20 | "type": "git",
21 | "url": "git@github.com:xwpongithub/vue-better-calendar.git"
22 | },
23 | "scripts": {
24 | "build": "node build/build.js",
25 | "dev": "node build/dev-server.js",
26 | "release": "bash ./build/release/publish.sh"
27 | },
28 | "devDependencies": {
29 | "autoprefixer": "^7.2.1",
30 | "babel-core": "^6.26.0",
31 | "babel-eslint": "^8.0.3",
32 | "babel-loader": "^7.1.2",
33 | "babel-plugin-add-module-exports": "^0.2.1",
34 | "babel-plugin-istanbul": "^4.1.5",
35 | "babel-plugin-transform-es2015-modules-umd": "^6.24.1",
36 | "babel-plugin-transform-runtime": "^6.23.0",
37 | "babel-polyfill": "^6.26.0",
38 | "babel-preset-env": "^1.6.1",
39 | "babel-preset-stage-2": "^6.24.1",
40 | "babel-register": "^6.26.0",
41 | "connect-history-api-fallback": "^1.5.0",
42 | "copy-webpack-plugin": "^4.2.3",
43 | "cross-env": "^5.1.1",
44 | "css-loader": "^0.28.7",
45 | "eslint": "^4.12.1",
46 | "eslint-config-standard": "^10.2.1",
47 | "eslint-friendly-formatter": "^3.0.0",
48 | "eslint-loader": "^1.9.0",
49 | "eslint-plugin-html": "^4.0.1",
50 | "eslint-plugin-import": "^2.8.0",
51 | "eslint-plugin-node": "^5.2.1",
52 | "eslint-plugin-promise": "^3.6.0",
53 | "eslint-plugin-standard": "^3.0.1",
54 | "eventsource-polyfill": "^0.9.6",
55 | "express": "^4.16.2",
56 | "extract-text-webpack-plugin": "^3.0.2",
57 | "file-loader": "^1.1.5",
58 | "friendly-errors-webpack-plugin": "^1.6.1",
59 | "html-webpack-plugin": "^2.30.1",
60 | "http-proxy-middleware": "^0.17.4",
61 | "inject-loader": "^3.0.1",
62 | "opn": "^5.1.0",
63 | "optimize-css-assets-webpack-plugin": "^3.2.0",
64 | "ora": "^1.3.0",
65 | "postcss-loader": "^2.0.9",
66 | "shelljs": "^0.7.8",
67 | "style-loader": "^0.19.0",
68 | "stylus": "^0.54.5",
69 | "stylus-loader": "^3.0.1",
70 | "url-loader": "^0.6.2",
71 | "vue": "^2.5.13",
72 | "vue-loader": "^13.5.0",
73 | "vue-router": "^3.0.1",
74 | "vue-style-loader": "^3.0.3",
75 | "vue-template-compiler": "^2.5.13",
76 | "webpack": "^3.10.0",
77 | "webpack-bundle-analyzer": ">=3.3.2",
78 | "webpack-dev-middleware": "^1.12.2",
79 | "webpack-hot-middleware": "^2.21.0",
80 | "webpack-merge": "^4.1.1"
81 | },
82 | "engines": {
83 | "node": ">= 4.0.0",
84 | "npm": ">= 3.0.0"
85 | },
86 | "browserslist": [
87 | "> 1%",
88 | "last 2 versions",
89 | "not ie <= 20",
90 | "not ie_mob <= 100",
91 | "not ff <= 100",
92 | "not and_ff <= 100",
93 | "not Edge <= 100",
94 | "Android >= 4.0",
95 | "iOS >= 7.0"
96 | ]
97 | }
98 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-better-calendar
2 | A calendar component for vuejs.
3 |
4 | [](https://www.npmjs.com/package/vue-better-calendar)
5 | [](https://www.npmjs.com/package/vue-better-calendar)
6 |
7 | ## 关于vue-better-calendar
8 | vue-better-calendar是一个基于vue的日期选择插件,它提供了四种日期选择模式(范围选择,多选,签到,单选)
9 |
10 | ## 在线示例
11 | [签到模式](https://codepen.io/lijinrong/pen/pLpxvo?editors=1111)
12 |
13 | [单选模式](https://codepen.io/lijinrong/pen/bvvrpW)
14 |
15 | [范围选择模式](https://codepen.io/lijinrong/pen/MVGKLP?editors=1010)
16 |
17 | ## 安装
18 |
19 | ### 使用npm安装
20 | ```node
21 | npm install --save vue-better-calendar
22 | ```
23 |
24 | ### ES6方式导入
25 | ```javascript
26 | import VueBetterCalendar from 'vue-better-calendar'
27 | Vue.use(VueBetterCalendar)
28 | ```
29 |
30 | ### 在组件中引入
31 | ```javascript
32 |
33 | ```
34 |
35 | ### 直接连入页面使用
36 | ```javascript
37 |
38 |
39 | ```
40 |
41 | ```html
42 |
43 |
44 |
45 | ```
46 |
47 | ```javascript
48 |
53 | ```
54 |
55 | ### 参数
56 | |名称|类型|默认值|说明|
57 | |:-:|:-:|:-:|:-:|
58 | |mode|String|multi|日期选择模式,支持四个有效值:multi 多选,range 范围选择,sign 签到,single 单选|
59 | |notSignInOtherMonthsTxt|String|不能在本月外进行签到|签到时点击本月外日期时的文本提示|
60 | |notSignInOtherDaysTxt|String|签到只能在当天进行|签到时点击本月内非当天日期时的文本提示|
61 | |alreadySignTxt|String|本日已经进行过签到|签到时点击已经签过到的日期时的文本提示|
62 | |signSuccessTxt|String|签到成功|签到成功时的文本提示|
63 | |limitBeginDate|Array|[]|限制可被选择的日期范围的开始日期,传参格式:[2018, 3, 1]|
64 | |limitEndDate|Array|[]|限制可被选择的日期范围的结束日期,传参格式:[2018, 4, 24]|
65 | |signedDates|Array|[]|已经签过到的日期,仅在签到模式下有用,传参格式:['2018-03-01', '2018-03-05']|
66 | |isZeroPad|Boolean|true|点选日期后返回结果中的日期月份和天数不够两位数时是否补0|
67 | |disabledDates|Array|[]|设置不可被选择的日期,传参格式:[[2018, 3, 1], [2018, 3, 24]]|
68 | |showLunar|Boolean|true|是否显示农历|
69 | |showDisableDate|Boolean|true|是否显示不可被选择的日期|
70 | |weeks|Array|['日', '一', '二', '三', '四', '五', '六']|星期栏文本|
71 | |months|Array|['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']|月份栏文本|
72 | |events|Object|{'2018-3-22': {className: 'price',title: '¥232',styles: {}}}|为某个日期添加单独的事件和文本|
73 | |ctlColor|String|#5e7a88|切换按钮颜色|
74 | |labelToday|Object|{showLabelToday: true,label: '今天'}|当天是否将显示的日期换成文本|
75 | |disableBeforeToday|Boolean|false|是否将今天以前的日期全部设为不可用|
76 | |disableAfterToday|Boolean|false|是否将今天以后的日期全部设为不可用|
77 | |hideHeader|Boolean|false|隐藏顶部日期月份选择显示|
78 | |hideWeeks|Boolean|false|隐藏星期显示|
79 |
80 | ### 支持事件
81 | |名称|回调参数|说明|
82 | |:-:|:-:|:-:|
83 | |select-year|year|选择年份时触发|
84 | |select-month|month, year|选择月份时触发|
85 | |select-range-date|selectedDates|范围选择模式下,选中想选择的日期范围时触发,返回选中的所有日期|
86 | |select-multi-date|selectedMultiDays|多选模式下,选中想选择的日期时触发,返回选中的所有日期|
87 | |click-disable-date|date,mode|点击不可选择日期时触发,返回所点击的日期和当前日期模式|
88 | |select-sign-date|{status,msg,signedDates}|点击日期签到时触发,status表示签到是否成功,msg为此次签到是否成功的提示语,signedDates为目前已经签过到的所有日期|
89 | |select-single-date|date|单选模式下,选则日期时触发,返回所选择的日期|
90 | |reset-select-range-date|无回调参数|范围选择模式下,重置选择的日期时触发|
91 | |next|month, year|切换到下一个月或者下一年时触发|
92 | |prev|month, year|切换到上一个月或者上一年时触发|
93 |
94 | ### 支持方法
95 | |名称|描述|
96 | |:-:|:-:|
97 | |setToday|选中当天日期|
98 | |resetRangDate|范围选择模式下,重置已选择的日期范围|
99 | |sign|单独通过按钮点击进行签到,会触发select-sign-date事件|
100 |
--------------------------------------------------------------------------------
/src/utils/date-utils.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 农历1900-2100的润大小信息表
3 | * Hex
4 | */
5 | export const lunarInfo =
6 | [
7 | 0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
8 | 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
9 | 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
10 | 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
11 | 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
12 | 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
13 | 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
14 | 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
15 | 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
16 | 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
17 | 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
18 | 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
19 | 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
20 | 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
21 | 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
22 | 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
23 | 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
24 | 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
25 | 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
26 | 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
27 | 0x0d520
28 | ]
29 |
30 | /**
31 | * 1900-2100各年的24节气日期速查表
32 | * 0x string For splice
33 | */
34 | export const sTermInfo =
35 | [
36 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
37 | '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
38 | '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
39 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
40 | 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
41 | '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
42 | '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
43 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
44 | '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
45 | '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
46 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
47 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
48 | '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
49 | '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
50 | '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
51 | '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
52 | '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
53 | '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
54 | '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
55 | '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
56 | '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
57 | '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
58 | '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
59 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
60 | '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
61 | '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
62 | '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
63 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
64 | '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
65 | '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
66 | '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
67 | '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
68 | '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
69 | '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
70 | '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
71 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
72 | '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
73 | '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
74 | '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
75 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
76 | '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
77 | '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
78 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
79 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
80 | '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
81 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
82 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
83 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
84 | '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
85 | '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
86 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
87 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
88 | '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
89 | '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
90 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
91 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
92 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
93 | '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
94 | '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
95 | '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
96 | '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
97 | '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
98 | '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
99 | '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
100 | '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
101 | '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
102 | '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'
103 | ]
104 |
105 | /**
106 | * 公历每个月份的天数普通表
107 | */
108 | export const solarMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
109 |
110 | /**
111 | * 天干地支之天干速查表
112 | * ['甲','乙','丙','丁','戊','己','庚','辛','壬','癸']
113 | */
114 | export const gan = ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678']
115 |
116 | /**
117 | * 天干地支之地支速查表
118 | * ['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥']
119 | */
120 | export const zhi = ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5']
121 |
122 | /**
123 | * 天干地支之地支速查表<=>生肖
124 | * ['鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪']
125 | */
126 | export const animals = ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a']
127 |
128 | /**
129 | * 24节气速查表
130 | * ['小寒','大寒','立春','雨水','惊蛰','春分','清明','谷雨','立夏','小满','芒种','夏至','小暑','大暑','立秋','处暑','白露','秋分','寒露','霜降','立冬','小雪','大雪','冬至']
131 | */
132 | export const solarTerm = [
133 | '\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0',
134 | '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1',
135 | '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb',
136 | '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d',
137 | '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'
138 | ]
139 |
140 | /**
141 | * 数字转中文速查表
142 | * ['日','一','二','三','四','五','六','七','八','九','十']
143 | */
144 | export const nStr1 = ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341']
145 |
146 | /**
147 | * 日期转农历称呼速查表
148 | * ['初','十','廿','卅']
149 | */
150 | export const nStr2 = ['\u521d', '\u5341', '\u5eff', '\u5345']
151 |
152 | /**
153 | * 月份转农历称呼速查表
154 | * ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
155 | */
156 | export const nStr3 = ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a']
157 |
158 | /**
159 | * 返回农历y年一整年的总天数
160 | * @param y Year
161 | * @return Number
162 | * @eg:var count = lYearDays(1987) ; // count=384
163 | */
164 | export function lYearDays(y) {
165 | let i
166 | let sum = 348
167 | for (i = 0x8000; i > 0x8; i >>= 1) {
168 | sum += (lunarInfo[y - 1900] & i) ? 1 : 0
169 | }
170 | return sum + leapDays(y)
171 | }
172 |
173 | /**
174 | * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
175 | * @param y Year
176 | * @return Number (0-12)
177 | * @eg:var leapMonth = leapMonth(1987) // leapMonth=6
178 | */
179 | export function leapMonth(y) {
180 | // 闰字编码 \u95f0
181 | return lunarInfo[y - 1900] & 0xf
182 | }
183 |
184 | /**
185 | * 返回农历y年闰月的天数 若该年没有闰月则返回0
186 | * @param y Year
187 | * @return Number (0、29、30)
188 | * @eg:var leapMonthDay = leapDays(1987) // leapMonthDay=29
189 | */
190 | export function leapDays(y) {
191 | if (leapMonth(y)) {
192 | return ((lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
193 | }
194 | return 0
195 | }
196 |
197 | /**
198 | * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
199 | * @param y Year
200 | * @param m Month
201 | * @return Number (-1、29、30)
202 | * @eg:var monthDay = monthDays(1987,9) // MonthDay=29
203 | */
204 | export function monthDays(y, m) {
205 | if (m > 12 || m < 1) return -1 // 月份参数从1至12,参数错误返回-1
206 | return (lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29
207 | }
208 |
209 | /**
210 | * 返回公历y年m月的天数
211 | * @param y Year
212 | * @param m Month
213 | * @return Number (-1、28、29、30、31)
214 | * @eg:var solarMonthDay = solarDays(1987) // solarMonthDay=30
215 | */
216 | export function solarDays(y, m) {
217 | if (m > 12 || m < 1) return -1 // 若参数错误 返回-1
218 | let ms = m - 1
219 | if (ms === 1) {
220 | // 2月份的闰平规律测算后确认返回28或29
221 | return (y % 4 === 0 && y % 100 !== 0) || (y % 400 === 0) ? 29 : 28
222 | } else {
223 | return solarMonth[ms]
224 | }
225 | }
226 |
227 | /**
228 | * 农历年份转换为干支纪年
229 | * @param lYear 农历年的年份数
230 | * @return string
231 | */
232 | export function toGanZhiYear(lYear) {
233 | let ganKey = (lYear - 3) % 10
234 | let zhiKey = (lYear - 3) % 12
235 | if (ganKey === 0) ganKey = 10 // 如果余数为0则为最后一个天干
236 | if (zhiKey === 0) zhiKey = 12 // 如果余数为0则为最后一个地支
237 | return gan[ganKey - 1] + zhi[zhiKey - 1]
238 | }
239 |
240 | /**
241 | * 公历月、日判断所属星座
242 | * @param cMonth month
243 | * @param cDay day
244 | * @return string
245 | */
246 | export function toAstro(cMonth, cDay) {
247 | const 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'
248 | const arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
249 | return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7' // 座
250 | }
251 |
252 | /**
253 | * 传入offset偏移量返回干支
254 | * @param offset 相对甲子的偏移量
255 | * @return string
256 | */
257 | export function toGanZhi(offset) {
258 | return gan[offset % 10] + zhi[offset % 12]
259 | }
260 |
261 | /**
262 | * 传入公历(!)y年获得该年第n个节气的公历日期
263 | * @param y 公历年(1900-2100)
264 | * @param n 二十四节气中的第几个节气(1~24),从n=1(小寒)算起
265 | * @return number
266 | * @eg:var _24 = getTerm(1987, 3) //_24 = 4 意即1987年2月4日立春
267 | */
268 | export function getTerm(y, n) {
269 | if (y < 1900 || y > 2100) return -1
270 | if (n < 1 || n > 24) return -1
271 | let _table = sTermInfo[y - 1900]
272 | let _info = [
273 | parseInt('0x' + _table.substr(0, 5)).toString(),
274 | parseInt('0x' + _table.substr(5, 5)).toString(),
275 | parseInt('0x' + _table.substr(10, 5)).toString(),
276 | parseInt('0x' + _table.substr(15, 5)).toString(),
277 | parseInt('0x' + _table.substr(20, 5)).toString(),
278 | parseInt('0x' + _table.substr(25, 5)).toString()
279 | ]
280 | let _calDay = [
281 | _info[0].substr(0, 1),
282 | _info[0].substr(1, 2),
283 | _info[0].substr(3, 1),
284 | _info[0].substr(4, 2),
285 | _info[1].substr(0, 1),
286 | _info[1].substr(1, 2),
287 | _info[1].substr(3, 1),
288 | _info[1].substr(4, 2),
289 | _info[2].substr(0, 1),
290 | _info[2].substr(1, 2),
291 | _info[2].substr(3, 1),
292 | _info[2].substr(4, 2),
293 | _info[3].substr(0, 1),
294 | _info[3].substr(1, 2),
295 | _info[3].substr(3, 1),
296 | _info[3].substr(4, 2),
297 | _info[4].substr(0, 1),
298 | _info[4].substr(1, 2),
299 | _info[4].substr(3, 1),
300 | _info[4].substr(4, 2),
301 | _info[5].substr(0, 1),
302 | _info[5].substr(1, 2),
303 | _info[5].substr(3, 1),
304 | _info[5].substr(4, 2)
305 | ]
306 | return parseInt(_calDay[n - 1])
307 | }
308 |
309 | /**
310 | * 传入农历数字月份返回汉语通俗表示法
311 | * @param m month
312 | * @return string
313 | * @eg:var cnMonth = toChinaMonth(12) // cnMonth = '腊月'
314 | */
315 | export function toChinaMonth(m) {
316 | if (m > 12 || m < 1) return -1 // 若参数错误 返回-1
317 | let s = nStr3[m - 1]
318 | s += '\u6708' // 加上月字
319 | return s
320 | }
321 |
322 | /**
323 | * 传入农历日期数字返回汉字表示法
324 | * @param d day
325 | * @return string
326 | * @eg:var cnDay = toChinaDay(21) // cnMonth = '廿一'
327 | */
328 | export function toChinaDay(d) {
329 | let s
330 | switch (d) {
331 | case 10:
332 | s = '\u521d\u5341'
333 | break
334 | case 20:
335 | s = '\u4e8c\u5341'
336 | break
337 | case 30:
338 | s = '\u4e09\u5341'
339 | break
340 | default :
341 | s = nStr2[Math.floor(d / 10)]
342 | s += nStr1[d % 10]
343 | }
344 | return s
345 | }
346 |
347 | /**
348 | * 年份转生肖,仅能大致转换 => 精确划分生肖分界线是“立春”
349 | * @param y year
350 | * @return string
351 | * @eg:var animal = getAnimal(1987) // animal='兔'
352 | */
353 | export function getAnimal(y) {
354 | return animals[(y - 4) % 12]
355 | }
356 |
357 | /**
358 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
359 | * @param y solar year
360 | * @param m solar month
361 | * @param d solar day
362 | * @return JSON object
363 | * @eg:console.log(solar2lunar(1987,11,01))
364 | * return {
365 | * Animal: "兔",
366 | * IDayCn: "初十",
367 | * IMonthCn: "九月",
368 | * Term: null,
369 | * astro: "天蝎座",
370 | * cDay: 1,
371 | * cMonth: 11,
372 | * cYear: 1987,
373 | * gzDay: "甲寅",
374 | * gzMonth: "庚戌",
375 | * gzYear: "丁卯",
376 | * isLeap: false,
377 | * isTerm: false,
378 | * isToday: false,
379 | * lDay: 10,
380 | * lMonth: 9,
381 | * lYear: 1987,
382 | * nWeek: 7,
383 | * ncWeek: "星期日"
384 | * }
385 | */
386 | export function solar2lunar(y, m, d) {
387 | // 参数区间1900.1.31~2100.12.31
388 | if (y < 1900 || y > 2100) return -1 // 年份限定、上限
389 | if (y === 1900 && m === 1 && d < 31) return -1 // 下限
390 | let i
391 | let leap = 0
392 | let temp = 0
393 | let objDate = new Date()
394 | if (y) {
395 | objDate = new Date(y, parseInt(m) - 1, d)
396 | }
397 | y = objDate.getFullYear()
398 | m = objDate.getMonth() + 1
399 | d = objDate.getDate()
400 | let offset = (Date.UTC(y, m - 1, d) - Date.UTC(1900, 0, 31)) / 86400000
401 | for (i = 1900; i < 2101 && offset > 0; i++) {
402 | temp = lYearDays(i)
403 | offset -= temp
404 | }
405 | if (offset < 0) {
406 | offset += temp
407 | i--
408 | }
409 | let isTodayObj = new Date()
410 | let isToday = false
411 | if (isTodayObj.getFullYear() === y && isTodayObj.getMonth() + 1 === m && isTodayObj.getDate() === d) {
412 | isToday = true
413 | }
414 | // 星期几
415 | let nWeek = objDate.getDay()
416 | let cWeek = nStr1[nWeek]
417 | if (nWeek === 0) nWeek = 7 // 数字表示周几顺应天朝周一开始的惯例
418 | let year = i
419 | leap = leapMonth(i) // 闰哪个月
420 | let isLeap = false
421 | // 效验闰月
422 | for (i = 1; i < 13 && offset > 0; i++) {
423 | // 闰月
424 | if (leap > 0 && i === (leap + 1) && isLeap === false) {
425 | --i
426 | isLeap = true
427 | temp = leapDays(year) // 计算农历闰月天数
428 | } else {
429 | temp = monthDays(year, i) // 计算农历普通月天数
430 | }
431 | // 解除闰月
432 | if (isLeap === true && i === leap + 1) isLeap = false
433 | offset -= temp
434 | }
435 | if (offset === 0 && leap > 0 && i === leap + 1) {
436 | if (isLeap) {
437 | isLeap = false
438 | } else {
439 | isLeap = true
440 | --i
441 | }
442 | }
443 | if (offset < 0) {
444 | offset += temp
445 | --i
446 | }
447 | // 农历月
448 | let month = i
449 | // 农历日
450 | let day = offset + 1
451 | // 天干地支处理
452 | let sm = m - 1
453 | let gzY = toGanZhiYear(year)
454 | // 月柱 1900年1月小寒以前为 丙子月(60进制12)
455 | let firstNode = getTerm(year, (m * 2 - 1)) // 返回当月「节」为几日开始
456 | let secondNode = getTerm(year, (m * 2)) // 返回当月「节」为几日开始
457 | // 依据12节气修正干支月
458 | let gzM = toGanZhi((y - 1900) * 12 + m + 11)
459 | if (d >= firstNode) {
460 | gzM = toGanZhi((y - 1900) * 12 + m + 12)
461 | }
462 | // 传入的日期的节气与否
463 | let isTerm = false
464 | let Term = null
465 | if (firstNode === d) {
466 | isTerm = true
467 | Term = solarTerm[m * 2 - 2]
468 | }
469 | if (secondNode === d) {
470 | isTerm = true
471 | Term = solarTerm[m * 2 - 1]
472 | }
473 | // 日柱 当月一日与 1900/1/1 相差天数
474 | let dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
475 | let gzD = toGanZhi(dayCyclical + d - 1)
476 | // 该日期所属的星座
477 | let astro = toAstro(m, d)
478 | return {
479 | lYear: year,
480 | lMonth: month,
481 | lDay: day,
482 | animal: getAnimal(year),
483 | IMonthCn: (isLeap ? '\u95f0' : '') + toChinaMonth(month),
484 | IDayCn: toChinaDay(day),
485 | cYear: y,
486 | cMonth: m,
487 | cDay: d,
488 | gzYear: gzY,
489 | gzMonth: gzM,
490 | gzDay: gzD,
491 | isToday,
492 | isLeap,
493 | nWeek,
494 | ncWeek: '\u661f\u671f' + cWeek,
495 | isTerm,
496 | Term,
497 | astro
498 | }
499 | }
500 |
501 | /**
502 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
503 | * @param y lunar year
504 | * @param m lunar month
505 | * @param d lunar day
506 | * @param isLeapMonth [如果是农历闰月第四个参数赋值true即可]
507 | * @return JSON object
508 | * @eg:console.log(lunar2solar(1987,9,10))
509 | * return {
510 | * IDayCn: "初十",
511 | * IMonthCn: "九月",
512 | * Term: null,
513 | * animal: "兔",
514 | * astro: "天蝎座",
515 | * cDay: 1,
516 | * cMonth: 11,
517 | * cYear: 1987,
518 | * gzDay: "甲寅",
519 | * gzMonth: "庚戌",
520 | * gzYear: "丁卯",
521 | * isLeap: false,
522 | * isTerm: false,
523 | * isToday: false,
524 | * lDay: 10,
525 | * lMonth: 9,
526 | * lYear: 1987,
527 | * nWeek: 7,
528 | * ncWeek: "星期日"
529 | * }
530 | */
531 | export function lunar2solar(y, m, d, isLeapMonth) {
532 | if ((y === 2100 && m === 12 && d > 1) || (y === 1900 && m === 1 && d < 31)) return -1 // 超出了最大极限值
533 | isLeapMonth = !!isLeapMonth
534 | let leapMonths = leapMonth(y)
535 | // 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
536 | if (isLeapMonth && leapMonths !== m) return -1
537 | let day = monthDays(y, m)
538 | let _day = day
539 | // bugFix 2016-9-25
540 | // if month is leap, _day use leapDays method
541 | if (isLeapMonth) {
542 | _day = leapDays(y)
543 | }
544 | if (y < 1900 || y > 2100 || d > _day) return -1 // 参数合法性效验
545 | // 计算农历的时间差
546 | let offset = 0
547 | for (let i = 1900; i < y; i++) {
548 | offset += lYearDays(i)
549 | }
550 | let leap = 0
551 | let isAdd = false
552 | for (let i = 1; i < m; i++) {
553 | leap = leapMonth(y)
554 | if (!isAdd) {
555 | // 处理闰月
556 | if (leap <= i && leap > 0) {
557 | offset += leapDays(y)
558 | isAdd = true
559 | }
560 | }
561 | offset += monthDays(y, i)
562 | }
563 | // 转换闰月农历 需补充该年闰月的前一个月的时差
564 | if (isLeapMonth) offset += day
565 | // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
566 | let stamp = Date.UTC(1900, 1, 30, 0, 0, 0)
567 | let calObj = new Date((offset + d - 31) * 86400000 + stamp)
568 | let cY = calObj.getUTCFullYear()
569 | let cM = calObj.getUTCMonth() + 1
570 | let cD = calObj.getUTCDate()
571 | return solar2lunar(cY, cM, cD)
572 | }
573 |
574 | // console.log(utils.lYearDays(1987))
575 | // console.log(utils.leapMonth(1987))
576 | // console.log(utils.leapDays(1987))
577 | // console.log(utils.monthDays(1987, 1))
578 | // console.log(utils.solarDays(2016, 2))
579 | // console.log(utils.toGanZhiYear(2018))
580 | // console.log(utils.toAstro(6, 14))
581 | // console.log(utils.toGanZhi(2))
582 | // console.log(utils.getTerm(1987, 3))
583 | // console.log(utils.toChinaMonth(1))
584 | // console.log(utils.toChinaDay(9))
585 | // console.log(utils.getAnimal(2017))
586 | // console.log(utils.solar2lunar(1987, 11, 1))
587 | // console.log(utils.lunar2solar(1993, 1, 8))
588 |
--------------------------------------------------------------------------------
/src/vue-better-calendar.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
44 |
45 |
46 |
47 |
48 | -
49 | {{weekday}}
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | -
59 |
60 |
61 | {{labelToday.showLabelToday && date.isToday ? labelToday.label : date.day}}
62 |
63 |
64 | {{date.lunar}}
65 |
66 |
67 | {{date.eventName.title}}
68 |
69 |
70 |
71 |
72 | {{date.day}}
73 |
74 |
75 | {{date.lunar}}
76 |
77 |
78 | {{date.eventName.title}}
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | {{y}}
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
954 |
955 |
1156 |
--------------------------------------------------------------------------------
/dist/vue-better-calendar.min.js:
--------------------------------------------------------------------------------
1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["vue-better-calendar"]=t():e["vue-better-calendar"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(a[n])return a[n].exports;var r=a[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="./",t(t.s=13)}([function(e,t){var a=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=a)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var a=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=a)},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,a){e.exports=!a(1)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,a){var n,r,i;!function(s,c){r=[e,t,a(21),a(44),a(50),a(51)],n=c,void 0!==(i="function"==typeof n?n.apply(t,r):n)&&(e.exports=i)}(0,function(e,t,a,n,r,i){"use strict";function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var c=s(a),o=s(n),d=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(r);t.default={name:"vue-better-calendar",props:{value:{type:Array,default:function(){return[]}},mode:{type:String,default:"range",validator:function(e){return["multi","range","sign","single"].indexOf(e)>-1}},notSignInOtherMonthsTxt:{type:String,default:"不能在本月外进行签到"},notSignInOtherDaysTxt:{type:String,default:"签到只能在当天进行"},alreadySignTxt:{type:String,default:"本日已经进行过签到"},signSuccessTxt:{type:String,default:"签到成功"},limitBeginDate:{type:Array,default:function(){return[]}},limitEndDate:{type:Array,default:function(){return[]}},signedDates:{type:Array,default:function(){return[]}},isZeroPad:{type:Boolean,default:!0},disabledDates:{type:Array,default:function(){return[]}},showLunar:{type:Boolean,default:!0},showDisableDate:{type:Boolean,default:!0},weeks:{type:Array,default:function(){return["日","一","二","三","四","五","六"]}},months:{type:Array,default:function(){return["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},events:{type:Object,default:function(){return{}}},labelToday:{type:Object,default:function(){return{showLabelToday:!0,label:"今天"}}},ctlColor:{type:String,default:"#5e7a88",validator:function(e){return(0,i.isValidColor)(e)}},disableBeforeToday:{type:Boolean,default:!1},disableAfterToday:{type:Boolean,default:!1},hideHeader:{type:Boolean,default:!1},hideWeeks:{type:Boolean,default:!1}},data:function(){return{years:[],days:[],multiDays:[],year:0,month:0,day:0,defaultSingleSelectDay:[],showYearPanel:!1,beginDate:[],endDate:[],dayItemMinHeight:0,dayItemLineHeight:"initial"}},computed:{prevYear:function(){var e=this.year;return this.month-1<0&&e--,e},nextYear:function(){var e=this.year;return this.month+1>11&&e++,e}},created:function(){this.festival={lunar:{"1-1":"春节","1-15":"元宵节","2-2":"龙头节","5-5":"端午节","7-7":"七夕节","7-15":"中元节","8-15":"中秋节","9-9":"重阳节","10-1":"寒衣节","10-15":"下元节","12-8":"腊八节","12-23":"祭灶节"},gregorian:{"1-1":"元旦","2-14":"情人节","3-8":"妇女节","3-12":"植树节","4-5":"清明节","5-1":"劳动节","5-4":"青年节","6-1":"儿童节","7-1":"建党节","8-1":"建军节","9-10":"教师节","10-1":"国庆节","12-24":"平安夜","12-25":"圣诞节"}}},mounted:function(){this.init()},methods:{init:function(){var e=new Date;if(this.year=e.getFullYear(),this.month=e.getMonth(),this.day=e.getDate(),this.value.length)if("range"===this.mode||"multi"===this.mode)if(this.year=parseInt(this.value[0][0]),this.month=parseInt(this.value[0][1])-1,this.day=parseInt(this.value[0][2]),"range"===this.mode){var t=parseInt(this.value[1][0]),a=parseInt(this.value[1][1])-1,n=parseInt(this.value[1][2]);this.beginDate=[this.year,this.month,this.day],this.endDate=[t,a,n]}else this.multiDays=this.value;else this.year=parseInt(this.value[0]),this.month=parseInt(this.value[1])-1,this.day=parseInt(this.value[2]);this.render(!0)},render:function(e){var t=this,a=this.year,n=this.month,r=new Date(a,n,1).getDay(),i=new Date(a,n+1,0).getDate(),s=new Date(a,n,0).getDate(),c=new Date,d=this.value,b=void 0,f=0,l=[],u=1;for(b=1;b<=i;b++){var h=new Date(a,n,b).getDay(),p=void 0;if(0===h)l[f]=[];else if(1===b){l[f]=[],p=s-r+1;for(var y=0;yNumber(new Date(this.year,this.month,b))&&(g.disabled=!0)}var x=this.limitEndDate;if(x.length){Number(new Date(parseInt(x[0]),parseInt(x[1])-1,parseInt(x[2])))_&&(g.disabled=!0);var I=this.beginDate,k=this.endDate;if(I.length){var S=Number(new Date(I[0],I[1],I[2])),M=Number(new Date(k[0],k[1],k[2])),C=Number(new Date(this.year,this.month,b));S<=C&&M>=C&&!g.disabled&&(g.selected=!0)}l[f].push(g)}else if("multi"===this.mode){g=this.value.filter(function(e){return t.year===e[0]&&t.month===e[1]-1&&b===e[2]}).length?(0,o.default)({day:b,year:this.year,month:this.month+1,selected:!0,disabled:!1},this._getLunarInfo(this.year,this.month+1,b),this._getEvents(this.year,this.month+1,b)):(0,o.default)({day:b,year:this.year,month:this.month+1,selected:!1,disabled:!1},this._getLunarInfo(this.year,this.month+1,b),this._getEvents(this.year,this.month+1,b));var T=this.limitBeginDate;if(T.length){var N=Number(new Date(parseInt(T[0]),parseInt(T[1])-1,parseInt(T[2])));N>Number(new Date(this.year,this.month,b))&&(g.disabled=!0)}var j=this.limitEndDate;if(j.length){var O=Number(new Date(parseInt(j[0]),parseInt(j[1])-1,parseInt(j[2])));OY&&(g.disabled=!0),l[f].push(g)}else if("sign"===this.mode){g=(0,o.default)({day:b,year:this.year,month:this.month+1,selected:!1,disabled:!1},this._getLunarInfo(this.year,this.month+1,b),this._getEvents(this.year,this.month+1,b));var F=+new Date(this.year+"/"+(this.month+1)+"/"+b),L=+new Date(c.getFullYear()+"/"+(c.getMonth()+1)+"/"+c.getDate());F===L&&(g.isToday=!0),this._checkInDates(F)>-1&&(g.selected=!0);var B=this.limitBeginDate;if(B.length){var $=Number(new Date(parseInt(B[0]),parseInt(B[1])-1,parseInt(B[2])));$>Number(new Date(this.year,this.month,b))&&(g.disabled=!0)}var z=this.limitEndDate;if(z.length){var A=Number(new Date(parseInt(z[0]),parseInt(z[1])-1,parseInt(z[2])));AL&&(g.disabled=!0),l[f].push(g)}else if("single"===this.mode){g=(0,o.default)({day:b,year:this.year,month:this.month+1,selected:!1,disabled:!1},this._getLunarInfo(this.year,this.month+1,b),this._getEvents(this.year,this.month+1,b)),d.length||c.getFullYear()!==this.year||c.getMonth()+1!==this.month+1?d.length&&this.year===Number(d[0])&&this.month+1===Number(d[1])&&b===Number(d[2])&&(g.selected=!0,this.defaultSingleSelectDay=[f,l[f].length-1]):(g.selectd=!0,this.defaultSingleSelectDay=[f,l[f].length-1]);var H=this.limitBeginDate;if(H.length){var G=Number(new Date(parseInt(H[0]),parseInt(H[1])-1,parseInt(H[2])));G>Number(new Date(this.year,this.month,b))&&(g.disabled=!0)}var W=this.limitEndDate;if(W.length){var Z=Number(new Date(parseInt(W[0]),parseInt(W[1])-1,parseInt(W[2])));ZJ&&(g.disabled=!0),l[f].push(g)}if(6===h&&b0)for(var K=f+1;K<=5;K++){l[K]=[];for(var ee=u+7*(K-f-1),te=ee;te<=ee+6;te++)l[K].push((0,o.default)({day:te,year:this.year,month:this._getNextMonth(!0),disabled:!0},this._getLunarInfo(this.nextYear,this._getNextMonth(!0),te),this._getEvents(this.nextYear,this._getNextMonth(!0),te)))}this.days=l,setTimeout(function(){if(t.$refs.dayItem){var a=t.$refs.dayItem[0].offsetWidth;t.dayItemMinHeight=a||0,t.showLunar||(t.dayItemLineHeight=a-20)}e&&t.$emit("ready")},30)},selectDate:function(e,t){var a=this,n=new Date,r=this.days[e][t];if(r.disabled){var s=this.isZeroPad?(0,i.pad)(r.month):r.month,c=this.isZeroPad?(0,i.pad)(r.day):r.day;return void this.$emit("click-disable-date",[String(this.year),String(s),String(c)],this.mode)}if("range"===this.mode){if(0===this.beginDate.length||0!==this.endDateTemp)this.beginDate=[this.year,this.month,this.days[e][t].day],this.beginDateTemp=this.beginDate,this.endDate=[this.year,this.month,this.days[e][t].day],this.endDateTemp=0;else{this.endDate=[this.year,this.month,this.days[e][t].day],this.endDateTemp=1,+new Date(this.endDate[0],this.endDate[1],this.endDate[2])<+new Date(this.beginDate[0],this.beginDate[1],this.beginDate[2])&&(this.beginDate=this.endDate,this.endDate=this.beginDateTemp);var o=[],d=[];this.isZeroPad?(this.beginDate.forEach(function(e,t){1===t&&(e+=1),o.push(String((0,i.pad)(e)))}),this.endDate.forEach(function(e,t){1===t&&(e+=1),d.push(String((0,i.pad)(e)))})):(o=this.beginDate,d=this.endDate);var b=+new Date(o[0]+"/"+o[1]+"/"+o[2]),f=+new Date(d[0]+"/"+d[1]+"/"+d[2]),l=[];this.days.forEach(function(e){e.forEach(function(e){var t=+new Date(e.year+"/"+e.month+"/"+e.day);if(!e.disabled&&t>=b&&t<=f){var n=a.isZeroPad?(0,i.pad)(e.month):e.month,r=a.isZeroPad?(0,i.pad)(e.day):e.day;l.push([String(e.year),String(n),String(r)])}})}),this.$emit("select-range-date",l)}this.render()}else if("multi"===this.mode){var u=this.multiDays.filter(function(n){return a.year===n[0]&&a.month===n[1]-1&&a.days[e][t].day===n[2]});u.length?this.multiDays=this.multiDays.filter(function(n){return a.year!==n[0]||a.month!==n[1]-1||a.days[e][t].day!==n[2]}):this.multiDays.push([this.year,this.month+1,this.days[e][t].day]),this.days[e][t].selected=!this.days[e][t].selected,this.multiDays=this.multiDays.sort(function(e,t){return+new Date(e[0],e[1]-1,e[2])>+new Date(t[0],t[1]-1,t[2])});var h=[];this.multiDays.forEach(function(e){var t=e[1],n=e[2];a.isZeroPad&&(t=(0,i.pad)(t),n=(0,i.pad)(n)),h.push([String(e[0]),String(t),String(n)])}),this.$emit("select-multi-date",h)}else if("sign"===this.mode){var p=this.signedDates.slice(),y=n.getMonth()+1;if(this.month+1!==y)return void this.$emit("select-sign-date",{status:!1,msg:this.notSignInOtherMonthsTxt,signedDates:p});var v=+new Date(this.year+"/"+(this.month+1)+"/"+this.days[e][t].day);if(v!==+new Date(n.getFullYear()+"/"+(n.getMonth()+1)+"/"+n.getDate()))return void this.$emit("select-sign-date",{status:!1,msg:this.notSignInOtherDaysTxt,signedDates:p});this._checkInDates(v)<0?(p.push(this.year+"-"+(0,i.pad)(this.month+1)+"-"+(0,i.pad)(this.days[e][t].day)),this.$emit("select-sign-date",{status:!0,msg:this.signSuccessTxt,signedDates:p})):this.$emit("select-sign-date",{status:!1,msg:this.alreadySignTxt,signedDates:p})}else"single"===this.mode&&(this.defaultSingleSelectDay.length&&this.days.forEach(function(e){e.forEach(function(e){e.selected=!1})}),this.days[e][t].selected=!0,this.day=this.days[e][t].day,this.defaultSingleSelectDay=[e,t],this.$emit("select-single-date",[String(this.year),String((0,i.pad)(this.month+1)),String((0,i.pad)(this.days[e][t].day))]))},sign:function(){var e=new Date,t=e.getFullYear(),a=e.getMonth()+1,n=e.getDate(),r=+new Date(t+"/"+a+"/"+n),s=this.signedDates.slice();this._checkInDates(r)<0?(s.push(t+"-"+(0,i.pad)(a)+"-"+(0,i.pad)(n)),this.$emit("select-sign-date",{status:!0,msg:this.signSuccessTxt,signedDates:s})):this.$emit("select-sign-date",{status:!1,msg:this.alreadySignTxt,signedDates:s})},getDateCls:function(e){var t={"is-today":e.isToday,selected:e.selected,disabled:e.disabled};return e.eventName&&e.eventName.className&&(t[e.eventName.className]=e.eventName.className),t},styleObj:function(e){var t={minHeight:this.dayItemMinHeight+"px"};return e.eventName&&e.eventName.styles&&(t=(0,o.default)({},t,e.eventName.styles)),t},prev:function(){0===this.month?(this.month=11,this.year=parseInt(this.year)-1):this.month=parseInt(this.month)-1,this._emitSelectMonthEvent("prev")},next:function(){11===this.month?(this.month=0,this.year=parseInt(this.year)+1):this.month=parseInt(this.month)+1,this._emitSelectMonthEvent("next")},changeYear:function(){if(this.showYearPanel)return void(this.showYearPanel=!1);this.showYearPanel=!0,this.years=[];for(var e=~~this.year-10;e<10+~~this.year;e++)this.years.push(e)},selectYear:function(e){this.showYearPanel=!1,this.year=e,this.render(),this.$emit("select-year",e)},setToday:function(){var e=this,t=new Date;this.year=t.getFullYear(),this.month=t.getMonth(),this.day=t.getDate(),this.render(),this.days.forEach(function(t){var a=t.find(function(t){return t.day===e.day&&!t.disabled});a&&(a.selected=!0)})},resetRangDate:function(){this.beginDate=[],this.endDate=[],this.$emit("reset-select-range-date"),this.render()},_checkInDates:function(e){return this.signedDates.findIndex(function(t){var a=t.replace(/-/g,"/");return+new Date(a)===e})},_emitSelectMonthEvent:function(e){this.render();var t=this.month+1;this.$emit("select-month",t,this.year),this.$emit(e,t,this.year)},_getLunarInfo:function(e,t,a){var n=d.solar2lunar(e,t,a),r=n.IDayCn,i=!1,s=!1;return this.festival.lunar[n.lMonth+"-"+n.lDay]?(r=this.festival.lunar[n.lMonth+"-"+n.lDay],i=!0):this.festival.gregorian[t+"-"+a]&&(r=this.festival.gregorian[t+"-"+a],s=!0),{lunar:r,isLunarFestival:i,isGregorianFestival:s}},_getPrevMonth:function(e){var t=this.month;return this.month-1<0?t=11:t--,e?t+1:t},_getNextMonth:function(e){var t=this.month;return this.month+1>11?t=0:t++,e?t+1:t},_getEvents:function(e,t,a){if((0,c.default)(this.events).length){var n=this.events[e+"-"+t+"-"+a],r=void 0;return n&&(r={},r.eventName=n),r}}},watch:{events:function(){this.render()},value:{handler:function(){"multi"!==this.mode&&this.init()},deep:!0},mode:function(){this.init()},signedDates:{handler:function(){this.render()},deep:!0}}},e.exports=t.default})},function(e,t,a){var n=a(7);e.exports=function(e){return Object(n(e))}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,a){var n=a(24),r=a(33);e.exports=Object.keys||function(e){return n(e,r)}},function(e,t,a){var n=a(10),r=a(7);e.exports=function(e){return n(r(e))}},function(e,t,a){var n=a(26);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t){var a=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:a)(e)}},function(e,t,a){var n=a(2),r=a(0),i=a(35),s=a(37),c=function(e,t,a){var o,d,b,f=e&c.F,l=e&c.G,u=e&c.S,h=e&c.P,p=e&c.B,y=e&c.W,v=l?r:r[t]||(r[t]={}),g=v.prototype,m=l?n:u?n[t]:(n[t]||{}).prototype;l&&(a=t);for(o in a)(d=!f&&m&&void 0!==m[o])&&o in v||(b=d?m[o]:a[o],v[o]=l&&"function"!=typeof m[o]?a[o]:p&&d?i(b,n):y&&m[o]==b?function(e){var t=function(t,a,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,a)}return new e(t,a,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(b):h&&"function"==typeof b?i(Function.call,b):b,h&&((v.virtual||(v.virtual={}))[o]=b,e&c.R&&g&&!g[o]&&s(g,o,b)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,a){var n,r,i;!function(s,c){r=[e,t,a(14)],n=c,void 0!==(i="function"==typeof n?n.apply(t,r):n)&&(e.exports=i)}(0,function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e&&e.__esModule?e:{default:e}}(a);n.default.version="1.3.2",n.default.install=function(e){e.component(n.default.name,n.default)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(n.default),t.default=n.default,e.exports=t.default})},function(e,t,a){"use strict";function n(e){a(15)}Object.defineProperty(t,"__esModule",{value:!0});var r=a(5),i=a.n(r);for(var s in r)"default"!==s&&function(e){a.d(t,e,function(){return r[e]})}(s);var c=a(52),o=a(20),d=n,b=o(i.a,c.a,!1,d,null,null);t.default=b.exports},function(e,t,a){var n=a(16);"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);a(18)("cf51ec06",n,!0,{})},function(e,t,a){t=e.exports=a(17)(!1),t.push([e.i,'.vue-better-calendar{position:relative;min-width:300px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:10px;font-family:PingFang SC,Hiragino Sans GB,STHeiti,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);border-radius:4px}.vue-better-calendar .calendar-header.calendar-header_hide{display:none}.vue-better-calendar .calendar-header .calendar-ctl{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;padding:6px 0}.vue-better-calendar .calendar-header .calendar-ctl .calendar-btn{position:relative;margin-top:6px;-webkit-box-flex:0;-webkit-flex:0 0 20px;flex:0 0 20px;width:20px;vertical-align:middle}.vue-better-calendar .calendar-header .calendar-ctl .calendar-btn:after{content:"";display:block;position:absolute;pointer-events:none;left:-10px;top:-10px;z-index:15;width:40px;height:40px}.vue-better-calendar .calendar-header .calendar-ctl .calendar-btn.calendar-btn-prev{text-align:left}.vue-better-calendar .calendar-header .calendar-ctl .calendar-btn.calendar-btn-next{text-align:right}.vue-better-calendar .calendar-header .calendar-ctl .calendar-ctl-month .month{position:relative;margin:0 auto;width:100px;height:20px;overflow:hidden;text-align:center;color:#5e7a88}.vue-better-calendar .calendar-header .calendar-ctl .calendar-ctl-month .month .select-month-panel{position:absolute;left:0;top:0;height:240px;width:100%;-webkit-transition:top .5s cubic-bezier(.075,.82,.165,1);transition:top .5s cubic-bezier(.075,.82,.165,1)}.vue-better-calendar .calendar-header .calendar-ctl .calendar-ctl-month .month .select-month-panel .item{overflow:hidden;height:20px;width:100%;text-align:center;font-size:14px}.vue-better-calendar .calendar-header .calendar-ctl .calendar-ctl-month .year{width:100px;margin:0 auto;text-align:center;font-size:10px;line-height:1;color:#999}.vue-better-calendar .calendar-body .calendar-weeks.calendar-weeks_hide{display:none}.vue-better-calendar .calendar-body .calendar-weeks ul{display:-webkit-box;display:-webkit-flex;display:flex;width:100%;overflow:hidden}.vue-better-calendar .calendar-body .calendar-weeks ul .weekday{-webkit-box-flex:1;-webkit-flex:1;flex:1;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit;text-align:center;font-size:14px;padding:15px}.vue-better-calendar .calendar-body .calendar-dates{position:relative;background-color:#eee;border-radius:4px}.vue-better-calendar .calendar-body .calendar-dates .date-row:first-child{padding-top:2px}.vue-better-calendar .calendar-body .calendar-dates .date-row ul{display:-webkit-box;display:-webkit-flex;display:flex;width:100%;overflow:hidden}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day{position:relative;-webkit-box-flex:1;-webkit-flex:1;flex:1;margin:0 2px 2px 0;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:inherit;text-align:center;padding:10px 5px;border-radius:4px;background-color:#fff}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day:first-of-type{margin-left:2px}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled{background-color:#d4d4d4;color:#b4b4b4}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-day.is-special-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-fest-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-fest-day.is-gregorian,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-fest-day.is-lunar,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.disabled .text.text-fest-day.is-special-day{color:#b4b4b4}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today{border:1px solid #bf7fba;background-color:#bf7fba;color:#fff}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-day.is-special-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-fest-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-fest-day.is-gregorian,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-fest-day.is-lunar,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.is-today .text.text-fest-day.is-special-day{color:#fff}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.selected:after{content:"";display:block;position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box;left:0;top:0;width:100%;height:100%;border-radius:4px;border:1px solid red}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.selected.disabled:after{display:none}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day.selected.is-today{color:#666;background-color:transparent}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;white-space:normal!important;-webkit-line-clamp:1;-webkit-box-orient:vertical;line-height:1.25;color:#666}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-custom-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-fest-day{font-size:11px}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-day.is-special-day,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-fest-day.is-special-day{color:red}.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-fest-day.is-gregorian,.vue-better-calendar .calendar-body .calendar-dates .date-row ul .calendar-day .text.text-fest-day.is-lunar{color:#09cd2c}.vue-better-calendar .calendar-year-panel{position:absolute;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-flex-wrap:wrap;flex-wrap:wrap;overflow:auto;left:0;right:0;top:64px;bottom:0;background-color:#fff;-webkit-transform:translateY(0);transform:translateY(0)}.vue-better-calendar .calendar-year-panel .item-year{margin:0 5px;width:60px;line-height:30px;border-radius:20px;text-align:center;border:1px solid #fbfbfb;color:#999}.vue-better-calendar .calendar-year-panel .item-year.active{border:1px solid #5e7a88;background-color:#5e7a88;color:#fff}.vue-better-calendar .calendar-year-panel.panel-show-enter,.vue-better-calendar .calendar-year-panel.panel-show-leave-to{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.vue-better-calendar .calendar-year-panel.panel-show-enter-active,.vue-better-calendar .calendar-year-panel.panel-show-leave-active{-webkit-transition:all .5s cubic-bezier(.075,.82,.165,1);transition:all .5s cubic-bezier(.075,.82,.165,1)}',""])},function(e,t){function a(e,t){var a=e[1]||"",r=e[3];if(!r)return a;if(t&&"function"==typeof btoa){var i=n(r);return[a].concat(r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"})).concat([i]).join("\n")}return[a].join("\n")}function n(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=a(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},r=0;ra.parts.length&&(n.parts.length=a.parts.length)}else{for(var s=[],r=0;ro;)n(c,a=t[o++])&&(~i(d,a)||d.push(a));return d}},function(e,t){var a={}.hasOwnProperty;e.exports=function(e,t){return a.call(e,t)}},function(e,t){var a={}.toString;e.exports=function(e){return a.call(e).slice(8,-1)}},function(e,t,a){var n=a(9),r=a(28),i=a(29);e.exports=function(e){return function(t,a,s){var c,o=n(t),d=r(o.length),b=i(s,d);if(e&&a!=a){for(;d>b;)if((c=o[b++])!=c)return!0}else for(;d>b;b++)if((e||b in o)&&o[b]===a)return e||b||0;return!e&&-1}}},function(e,t,a){var n=a(11),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e,t,a){var n=a(11),r=Math.max,i=Math.min;e.exports=function(e,t){return e=n(e),e<0?r(e+t,0):i(e,t)}},function(e,t,a){var n=a(31)("keys"),r=a(32);e.exports=function(e){return n[e]||(n[e]=r(e))}},function(e,t,a){var n=a(2),r=n["__core-js_shared__"]||(n["__core-js_shared__"]={});e.exports=function(e){return r[e]||(r[e]={})}},function(e,t){var a=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++a+n).toString(36))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,a){var n=a(12),r=a(0),i=a(1);e.exports=function(e,t){var a=(r.Object||{})[e]||Object[e],s={};s[e]=t(a),n(n.S+n.F*i(function(){a(1)}),"Object",s)}},function(e,t,a){var n=a(36);e.exports=function(e,t,a){if(n(e),void 0===t)return e;switch(a){case 1:return function(a){return e.call(t,a)};case 2:return function(a,n){return e.call(t,a,n)};case 3:return function(a,n,r){return e.call(t,a,n,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,a){var n=a(38),r=a(43);e.exports=a(4)?function(e,t,a){return n.f(e,t,r(1,a))}:function(e,t,a){return e[t]=a,e}},function(e,t,a){var n=a(39),r=a(40),i=a(42),s=Object.defineProperty;t.f=a(4)?Object.defineProperty:function(e,t,a){if(n(e),t=i(t,!0),n(a),r)try{return s(e,t,a)}catch(e){}if("get"in a||"set"in a)throw TypeError("Accessors not supported!");return"value"in a&&(e[t]=a.value),e}},function(e,t,a){var n=a(3);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,a){e.exports=!a(4)&&!a(1)(function(){return 7!=Object.defineProperty(a(41)("div"),"a",{get:function(){return 7}}).a})},function(e,t,a){var n=a(3),r=a(2).document,i=n(r)&&n(r.createElement);e.exports=function(e){return i?r.createElement(e):{}}},function(e,t,a){var n=a(3);e.exports=function(e,t){if(!n(e))return e;var a,r;if(t&&"function"==typeof(a=e.toString)&&!n(r=a.call(e)))return r;if("function"==typeof(a=e.valueOf)&&!n(r=a.call(e)))return r;if(!t&&"function"==typeof(a=e.toString)&&!n(r=a.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,a){e.exports={default:a(45),__esModule:!0}},function(e,t,a){a(46),e.exports=a(0).Object.assign},function(e,t,a){var n=a(12);n(n.S+n.F,"Object",{assign:a(47)})},function(e,t,a){"use strict";var n=a(8),r=a(48),i=a(49),s=a(6),c=a(10),o=Object.assign;e.exports=!o||a(1)(function(){var e={},t={},a=Symbol(),n="abcdefghijklmnopqrst";return e[a]=7,n.split("").forEach(function(e){t[e]=e}),7!=o({},e)[a]||Object.keys(o({},t)).join("")!=n})?function(e,t){for(var a=s(e),o=arguments.length,d=1,b=r.f,f=i.f;o>d;)for(var l,u=c(arguments[d++]),h=b?n(u).concat(b(u)):n(u),p=h.length,y=0;p>y;)f.call(u,l=h[y++])&&(a[l]=u[l]);return a}:o},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,a){var n,r,i;!function(a,s){r=[t],n=s,void 0!==(i="function"==typeof n?n.apply(t,r):n)&&(e.exports=i)}(0,function(e){"use strict";function t(e){var t=void 0,a=348;for(t=32768;t>8;t>>=1)a+=p[e-1900]&t?1:0;return a+n(e)}function a(e){return 15&p[e-1900]}function n(e){return a(e)?65536&p[e-1900]?30:29:0}function r(e,t){return t>12||t<1?-1:p[e-1900]&65536>>t?30:29}function i(e,t){if(t>12||t<1)return-1;var a=t-1;return 1===a?e%4==0&&e%100!=0||e%400==0?29:28:v[a]}function s(e){var t=(e-3)%10,a=(e-3)%12;return 0===t&&(t=10),0===a&&(a=12),g[t-1]+m[a-1]}function c(e,t){return"魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯".substr(2*e-(t<[20,19,21,21,21,22,23,23,23,23,22,22][e-1]?2:0),2)+"座"}function o(e){return g[e%10]+m[e%12]}function d(e,t){if(e<1900||e>2100)return-1;if(t<1||t>24)return-1;var a=y[e-1900],n=[parseInt("0x"+a.substr(0,5)).toString(),parseInt("0x"+a.substr(5,5)).toString(),parseInt("0x"+a.substr(10,5)).toString(),parseInt("0x"+a.substr(15,5)).toString(),parseInt("0x"+a.substr(20,5)).toString(),parseInt("0x"+a.substr(25,5)).toString()],r=[n[0].substr(0,1),n[0].substr(1,2),n[0].substr(3,1),n[0].substr(4,2),n[1].substr(0,1),n[1].substr(1,2),n[1].substr(3,1),n[1].substr(4,2),n[2].substr(0,1),n[2].substr(1,2),n[2].substr(3,1),n[2].substr(4,2),n[3].substr(0,1),n[3].substr(1,2),n[3].substr(3,1),n[3].substr(4,2),n[4].substr(0,1),n[4].substr(1,2),n[4].substr(3,1),n[4].substr(4,2),n[5].substr(0,1),n[5].substr(1,2),n[5].substr(3,1),n[5].substr(4,2)];return parseInt(r[t-1])}function b(e){if(e>12||e<1)return-1;var t=I[e-1];return t+="月"}function f(e){var t=void 0;switch(e){case 10:t="初十";break;case 20:t="二十";break;case 30:t="三十";break;default:t=_[Math.floor(e/10)],t+=D[e%10]}return t}function l(e){return x[(e-4)%12]}function u(e,i,u){if(e<1900||e>2100)return-1;if(1900===e&&1===i&&u<31)return-1;var h=void 0,p=0,y=0,v=new Date;e&&(v=new Date(e,parseInt(i)-1,u)),e=v.getFullYear(),i=v.getMonth()+1,u=v.getDate();var g=(Date.UTC(e,i-1,u)-Date.UTC(1900,0,31))/864e5;for(h=1900;h<2101&&g>0;h++)y=t(h),g-=y;g<0&&(g+=y,h--);var m=new Date,x=!1;m.getFullYear()===e&&m.getMonth()+1===i&&m.getDate()===u&&(x=!0);var _=v.getDay(),I=D[_];0===_&&(_=7);var k=h;p=a(h);var S=!1;for(h=1;h<13&&g>0;h++)p>0&&h===p+1&&!1===S?(--h,S=!0,y=n(k)):y=r(k,h),!0===S&&h===p+1&&(S=!1),g-=y;0===g&&p>0&&h===p+1&&(S?S=!1:(S=!0,--h)),g<0&&(g+=y,--h);var M=h,C=g+1,T=i-1,N=s(k),j=d(k,2*i-1),O=d(k,2*i),E=o(12*(e-1900)+i+11);u>=j&&(E=o(12*(e-1900)+i+12));var P=!1,Y=null;j===u&&(P=!0,Y=w[2*i-2]),O===u&&(P=!0,Y=w[2*i-1]);var F=Date.UTC(e,T,1,0,0,0,0)/864e5+25567+10,L=o(F+u-1),B=c(i,u);return{lYear:k,lMonth:M,lDay:C,animal:l(k),IMonthCn:(S?"闰":"")+b(M),IDayCn:f(C),cYear:e,cMonth:i,cDay:u,gzYear:N,gzMonth:E,gzDay:L,isToday:x,isLeap:S,nWeek:_,ncWeek:"星期"+I,isTerm:P,Term:Y,astro:B}}function h(e,i,s,c){if(2100===e&&12===i&&s>1||1900===e&&1===i&&s<31)return-1;c=!!c;var o=a(e);if(c&&o!==i)return-1;var d=r(e,i),b=d;if(c&&(b=n(e)),e<1900||e>2100||s>b)return-1;for(var f=0,l=1900;l0&&(f+=n(e),p=!0),f+=r(e,y);c&&(f+=d);var v=Date.UTC(1900,1,30,0,0,0),g=new Date(864e5*(f+s-31)+v);return u(g.getUTCFullYear(),g.getUTCMonth()+1,g.getUTCDate())}Object.defineProperty(e,"__esModule",{value:!0}),e.lYearDays=t,e.leapMonth=a,e.leapDays=n,e.monthDays=r,e.solarDays=i,e.toGanZhiYear=s,e.toAstro=c,e.toGanZhi=o,e.getTerm=d,e.toChinaMonth=b,e.toChinaDay=f,e.getAnimal=l,e.solar2lunar=u,e.lunar2solar=h;var p=e.lunarInfo=[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970,19168,42422,42192,53840,119381,46400,54944,44450,38320,84343,18800,42160,46261,27216,27968,109396,11104,38256,21234,18800,25958,54432,59984,28309,23248,11104,100067,37600,116951,51536,54432,120998,46416,22176,107956,9680,37584,53938,43344,46423,27808,46416,86869,19872,42416,83315,21168,43432,59728,27296,44710,43856,19296,43748,42352,21088,62051,55632,23383,22176,38608,19925,19152,42192,54484,53840,54616,46400,46752,103846,38320,18864,43380,42160,45690,27216,27968,44870,43872,38256,19189,18800,25776,29859,59984,27480,21952,43872,38613,37600,51552,55636,54432,55888,30034,22176,43959,9680,37584,51893,43344,46240,47780,44368,21977,19360,42416,86390,21168,43312,31060,27296,44368,23378,19296,42726,42208,53856,60005,54576,23200,30371,38608,19195,19152,42192,118966,53840,54560,56645,46496,22224,21938,18864,42359,42160,43600,111189,27936,44448,84835,37744,18936,18800,25776,92326,59984,27424,108228,43744,41696,53987,51552,54615,54432,55888,23893,22176,42704,21972,21200,43448,43344,46240,46758,44368,21920,43940,42416,21168,45683,26928,29495,27296,44368,84821,19296,42352,21732,53600,59752,54560,55968,92838,22224,19168,43476,41680,53584,62034,54560],y=e.sTermInfo=["9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd0b06bdb0722c965ce1cfcc920f","b027097bd097c36b0b6fc9274c91aa","9778397bd19801ec9210c965cc920e","97b6b97bd19801ec95f8c965cc920f","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd197c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bd09801d98082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec95f8c965cc920e","97bcf97c3598082c95f8e1cfcc920f","97bd097bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c3598082c95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf97c359801ec95f8c965cc920f","97bd097bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd19801ec9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b97bd19801ec95f8c965cc920f","97bd07f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c91aa","97b6b97bd19801ec9210c965cc920e","97bd07f1487f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c965cc920e","97bcf7f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b97bd19801ec9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b97bd197c36c9210c9274c920e","97bcf7f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","9778397bd097c36c9210c9274c920e","97b6b7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c36b0b6fc9210c8dc2","9778397bd097c36b0b70c9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9274c91aa","97b6b7f0e47f531b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c91aa","97b6b7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","9778397bd097c36b0b6fc9210c8dc2","977837f0e37f149b0723b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f5307f595b0b0bc920fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f595b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc9210c8dc2","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd097c35b0b6fc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0b0bb0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14998082b0723b06bd","7f07e7f0e37f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e397bd07f595b0b0bc920fb0722","977837f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f595b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e37f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f1487f531b0b0bb0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e47f149b0723b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14998082b0723b06bd","7f07e7f0e37f14998083b0787b0721","7f0e27f0e47f531b0723b0b6fb0722","7f0e37f0e366aa89801eb072297c35","7ec967f0e37f14898082b0723b02d5","7f07e7f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66aa89801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b0721","7f07e7f0e47f531b0723b0b6fb0722","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b0723b02d5","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e36665b66a449801e9808297c35","665f67f0e37f14898082b072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e26665b66a449801e9808297c35","665f67f0e37f1489801eb072297c35","7ec967f0e37f14998082b0787b06bd","7f07e7f0e47f531b0723b0b6fb0721","7f0e27f1487f531b0b0bb0b6fb0722"],v=e.solarMonth=[31,28,31,30,31,30,31,31,30,31,30,31],g=e.gan=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],m=e.zhi=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],x=e.animals=["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"],w=e.solarTerm=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"],D=e.nStr1=["日","一","二","三","四","五","六","七","八","九","十"],_=e.nStr2=["初","十","廿","卅"],I=e.nStr3=["正","二","三","四","五","六","七","八","九","十","冬","腊"]})},function(e,t,a){var n,r,i;!function(a,s){r=[t],n=s,void 0!==(i="function"==typeof n?n.apply(t,r):n)&&(e.exports=i)}(0,function(e){"use strict";function t(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"0",n=e.toString().length;n