├── .babelrc
├── .editorconfig
├── .gitignore
├── .postcssrc.js
├── LICENSE
├── README.md
├── build
├── build.js
├── check-versions.js
├── dev-client.js
├── dev-server.js
├── dist
│ ├── static
│ │ ├── vue-jLunar-datePicker.min.js
│ │ └── vue-jLunar-datePicker.min.js.map
│ ├── vue-jLunar-datePicker.min.js
│ └── vue-jLunar-datePicker.min.js.map
├── utils.js
├── vue-loader.conf.js
├── webpack.base.conf.js
├── webpack.dev.conf.js
└── webpack.prod.conf.js
├── config
├── dev.env.js
├── index.js
└── prod.env.js
├── dist
├── static
│ ├── fonts
│ │ ├── iconfont.46c5e08.woff
│ │ ├── iconfont.5dd7124.ttf
│ │ └── iconfont.d96bda3.eot
│ └── img
│ │ └── iconfont.7d4ee51.svg
├── vue-jLunar-datePicker.min.css
├── vue-jLunar-datePicker.min.css.map
├── vue-jLunar-datePicker.min.js
└── vue-jLunar-datePicker.min.js.map
├── index.html
├── package.json
├── src
├── App.vue
├── components
│ ├── JDatePicker.vue
│ ├── index.js
│ └── jDatePicker.js
├── main.js
└── theme
│ ├── font
│ └── iconfont
│ │ ├── iconfont.eot
│ │ ├── iconfont.js
│ │ ├── iconfont.svg
│ │ ├── iconfont.ttf
│ │ └── iconfont.woff
│ └── public.css
└── static
├── .gitkeep
└── DEMO.png
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-runtime"],
12 | "env": {
13 | "test": {
14 | "presets": ["env", "stage-2"],
15 | "plugins": ["istanbul"]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.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
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | npm-debug.log*
4 | yarn-debug.log*
5 | yarn-error.log*
6 |
7 | # Editor directories and files
8 | .idea
9 | *.suo
10 | *.ntvs*
11 | *.njsproj
12 | *.sln
13 |
--------------------------------------------------------------------------------
/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | // to edit target browsers: use "browserslist" field in package.json
6 | "autoprefixer": {}
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 vue-jLunar-datePicker
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-jLunar-datePicker
2 | @JinWen
3 |
4 | > Lunar-Date-Picker component, lightWeight, powerful, easy to use, with festival and solar terms.
5 |
6 |
7 | 
8 |
9 |
10 | # Online demo
11 | * [enjoy the demo](https://tuhe32.github.io/vue-jLunar-datePicker/)
12 |
13 | ### Getting Start
14 |
15 | ---
16 |
17 |
18 | **New for 2.0**
19 |
20 | 1、add a new Property :
21 | type : DATE/DATERANGE (you can pick a period of time by use DATERANGE option)
22 |
23 | 2、fixed bugs
24 |
25 | **Install**
26 |
27 | `npm install vue-jlunar-datepicker --save`
28 |
29 | **Usage**
30 |
31 | main.js
32 |
33 | ```vue
34 | import Vue from 'vue';
35 |
36 | import JDatePicker from 'vue-jlunar-datepicker';
37 |
38 | Vue.component("j-date-picker",JDatePicker);
39 |
40 | ```
41 |
42 | test.vue
43 |
44 | ```vue
45 |
46 |
59 |
60 |
61 |
88 | ```
89 |
90 |
91 | ### API
92 |
93 | ---
94 |
95 | **Attributes**
96 |
97 | | Properties | Description | Type | Optional value | Default value |
98 | | :---------------- | :--------------------------------------- | :------ | :------------ | :------------ |
99 | | value | bind-value(v-model) | String,Date,Array | -- | -- |
100 | | width | width | String | -- | 200px/200 |
101 | | type |you can pick a day or pick a period of time | String | DATE/DATERANGE | DATE |
102 | | showLunarClass | The display type of a lunar date; case insensitive; | String | FULLLUNAR/LUNAR/NUMBER/MIX| NUMBER|
103 | | showLunarIcon | whether to show lunar icon | Boolean | true/false | false |
104 | | showBackYears | the years number after now based on the current year | Number | -- | 2 |
105 | | format | format Date | String | -- | YYYY-MM-DD |
106 | | showLunarControl | whether to show the lunar control by default | Boolean | true/false | true |
107 | | editable | whether to input your date int the component | Boolean | true/false | false |
108 | | placeholder | placeholder for component | String | -- | -- |
109 | | clearable | whether to show the clear button | Boolean | true/false | true |
110 | | disabled | whether to disable this component | Boolean | true/false | false |
111 | | rangeSeparator | date separator | String | -- | '-' |
112 | | picker-options | refer to the following | object | -- | {} |
113 |
114 | **picker-options**
115 |
116 | | Properties | Description | Type | Optional value | Default value |
117 | | :---------------- | :--------------------------------------- | :------ | :------------ | :------------ |
118 | | disabledDate | Set disable date.Parameter is current date.you should return Boolean .Like examples! | Function | -- | -- |
119 |
120 |
121 | **event**
122 |
123 | | event name | Description | return |
124 | | :---------------- | :--------------------------------------- | :------ |
125 | | change | When the input value changes return the value | value |
126 |
127 |
128 |
129 | **GitHub**
130 | https://github.com/tuhe32/vue-jLunar-datePicker
131 |
132 | **OSChina**
133 | https://gitee.com/tuhe32/vue-jLunar-datePicker
134 |
135 | For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
136 |
--------------------------------------------------------------------------------
/build/build.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | var ora = require('ora')
6 | var rm = require('rimraf')
7 | var path = require('path')
8 | var chalk = require('chalk')
9 | var webpack = require('webpack')
10 | var config = require('../config')
11 | var webpackConfig = require('./webpack.prod.conf')
12 |
13 | var spinner = ora('building for production...')
14 | spinner.start()
15 |
16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17 | if (err) throw err
18 | webpack(webpackConfig, function (err, stats) {
19 | spinner.stop()
20 | if (err) throw err
21 | process.stdout.write(stats.toString({
22 | colors: true,
23 | modules: false,
24 | children: false,
25 | chunks: false,
26 | chunkModules: false
27 | }) + '\n\n')
28 |
29 | if (stats.hasErrors()) {
30 | console.log(chalk.red(' Build failed with errors.\n'))
31 | process.exit(1)
32 | }
33 |
34 | console.log(chalk.cyan(' Build complete.\n'))
35 | console.log(chalk.yellow(
36 | ' Tip: built files are meant to be served over an HTTP server.\n' +
37 | ' Opening index.html over file:// won\'t work.\n'
38 | ))
39 | })
40 | })
41 |
--------------------------------------------------------------------------------
/build/check-versions.js:
--------------------------------------------------------------------------------
1 | var chalk = require('chalk')
2 | var semver = require('semver')
3 | var packageConfig = require('../package.json')
4 | var shell = require('shelljs')
5 | function exec (cmd) {
6 | return require('child_process').execSync(cmd).toString().trim()
7 | }
8 |
9 | var versionRequirements = [
10 | {
11 | name: 'node',
12 | currentVersion: semver.clean(process.version),
13 | versionRequirement: packageConfig.engines.node
14 | }
15 | ]
16 |
17 | if (shell.which('npm')) {
18 | versionRequirements.push({
19 | name: 'npm',
20 | currentVersion: exec('npm --version'),
21 | versionRequirement: packageConfig.engines.npm
22 | })
23 | }
24 |
25 | module.exports = function () {
26 | var warnings = []
27 | for (var i = 0; i < versionRequirements.length; i++) {
28 | var mod = versionRequirements[i]
29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30 | warnings.push(mod.name + ': ' +
31 | chalk.red(mod.currentVersion) + ' should be ' +
32 | chalk.green(mod.versionRequirement)
33 | )
34 | }
35 | }
36 |
37 | if (warnings.length) {
38 | console.log('')
39 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
40 | console.log()
41 | for (var i = 0; i < warnings.length; i++) {
42 | var warning = warnings[i]
43 | console.log(' ' + warning)
44 | }
45 | console.log()
46 | process.exit(1)
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 |
3 | var config = require('../config')
4 | if (!process.env.NODE_ENV) {
5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6 | }
7 |
8 | var opn = require('opn')
9 | var path = require('path')
10 | var express = require('express')
11 | var webpack = require('webpack')
12 | var proxyMiddleware = require('http-proxy-middleware')
13 | var webpackConfig = require('./webpack.dev.conf')
14 |
15 | // default port where dev server listens for incoming traffic
16 | var port = process.env.PORT || config.dev.port
17 | // automatically open browser, if not set will be false
18 | var autoOpenBrowser = !!config.dev.autoOpenBrowser
19 | // Define HTTP proxies to your custom API backend
20 | // https://github.com/chimurai/http-proxy-middleware
21 | var proxyTable = config.dev.proxyTable
22 |
23 | var app = express()
24 | var compiler = webpack(webpackConfig)
25 |
26 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
27 | publicPath: webpackConfig.output.publicPath,
28 | quiet: true
29 | })
30 |
31 | var hotMiddleware = require('webpack-hot-middleware')(compiler, {
32 | log: false,
33 | heartbeat: 2000
34 | })
35 | // force page reload when html-webpack-plugin template changes
36 | compiler.plugin('compilation', function (compilation) {
37 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
38 | hotMiddleware.publish({ action: 'reload' })
39 | cb()
40 | })
41 | })
42 |
43 | // proxy api requests
44 | Object.keys(proxyTable).forEach(function (context) {
45 | var options = proxyTable[context]
46 | if (typeof options === 'string') {
47 | options = { target: options }
48 | }
49 | app.use(proxyMiddleware(options.filter || context, options))
50 | })
51 |
52 | // handle fallback for HTML5 history API
53 | app.use(require('connect-history-api-fallback')())
54 |
55 | // serve webpack bundle output
56 | app.use(devMiddleware)
57 |
58 | // enable hot-reload and state-preserving
59 | // compilation error display
60 | app.use(hotMiddleware)
61 |
62 | // serve pure static assets
63 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
64 | app.use(staticPath, express.static('./static'))
65 |
66 | var uri = 'http://localhost:' + port
67 |
68 | var _resolve
69 | var readyPromise = new Promise(resolve => {
70 | _resolve = resolve
71 | })
72 |
73 | console.log('> Starting dev server...')
74 | devMiddleware.waitUntilValid(() => {
75 | console.log('> Listening at ' + uri + '\n')
76 | // when env is testing, don't need open it
77 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
78 | opn(uri)
79 | }
80 | _resolve()
81 | })
82 |
83 | var server = app.listen(port)
84 |
85 | module.exports = {
86 | ready: readyPromise,
87 | close: () => {
88 | server.close()
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/build/utils.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config')
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
4 |
5 | exports.assetsPath = function (_path) {
6 | var assetsSubDirectory = process.env.NODE_ENV === 'production'
7 | ? config.build.assetsSubDirectory
8 | : config.dev.assetsSubDirectory
9 | return path.posix.join(assetsSubDirectory, _path)
10 | }
11 |
12 | exports.cssLoaders = function (options) {
13 | options = options || {}
14 |
15 | var cssLoader = {
16 | loader: 'css-loader',
17 | options: {
18 | minimize: process.env.NODE_ENV === 'production',
19 | sourceMap: options.sourceMap
20 | }
21 | }
22 |
23 | // generate loader string to be used with extract text plugin
24 | function generateLoaders (loader, loaderOptions) {
25 | var loaders = [cssLoader]
26 | if (loader) {
27 | loaders.push({
28 | loader: loader + '-loader',
29 | options: Object.assign({}, loaderOptions, {
30 | sourceMap: options.sourceMap
31 | })
32 | })
33 | }
34 |
35 | // Extract CSS when that option is specified
36 | // (which is the case during production build)
37 | if (options.extract) {
38 | return ExtractTextPlugin.extract({
39 | use: loaders,
40 | fallback: 'vue-style-loader'
41 | })
42 | } else {
43 | return ['vue-style-loader'].concat(loaders)
44 | }
45 | }
46 |
47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
48 | return {
49 | css: generateLoaders(),
50 | postcss: generateLoaders(),
51 | less: generateLoaders('less'),
52 | sass: generateLoaders('sass', { indentedSyntax: true }),
53 | scss: generateLoaders('sass'),
54 | stylus: generateLoaders('stylus'),
55 | styl: generateLoaders('stylus')
56 | }
57 | }
58 |
59 | // Generate loaders for standalone style files (outside of .vue)
60 | exports.styleLoaders = function (options) {
61 | var output = []
62 | var loaders = exports.cssLoaders(options)
63 | for (var extension in loaders) {
64 | var loader = loaders[extension]
65 | output.push({
66 | test: new RegExp('\\.' + extension + '$'),
67 | use: loader
68 | })
69 | }
70 | return output
71 | }
72 |
--------------------------------------------------------------------------------
/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var config = require('../config')
3 | var isProduction = process.env.NODE_ENV === 'production'
4 |
5 | module.exports = {
6 | loaders: utils.cssLoaders({
7 | sourceMap: isProduction
8 | ? config.build.productionSourceMap
9 | : config.dev.cssSourceMap,
10 | extract: isProduction
11 | }),
12 | transformToRequire: {
13 | video: 'src',
14 | source: 'src',
15 | img: 'src',
16 | image: 'xlink:href'
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var config = require('../config')
4 | var vueLoaderConfig = require('./vue-loader.conf')
5 |
6 | function resolve (dir) {
7 | return path.join(__dirname, '..', dir)
8 | }
9 |
10 | module.exports = {
11 | entry: {
12 | app: './src/main.js'
13 | },
14 | output: {
15 | path: config.bundle.assetsRoot,
16 | filename: '[name].js',
17 | publicPath: process.env.NODE_ENV === 'production'
18 | ? config.build.assetsPublicPath
19 | : config.dev.assetsPublicPath
20 | },
21 | resolve: {
22 | extensions: ['.js', '.vue', '.json'],
23 | alias: {
24 | 'vue$': 'vue/dist/vue.esm.js',
25 | '@': resolve('src'),
26 | }
27 | },
28 | module: {
29 | rules: [
30 | {
31 | test: /\.vue$/,
32 | loader: 'vue-loader',
33 | options: vueLoaderConfig
34 | },
35 | {
36 | test: /\.js$/,
37 | loader: 'babel-loader',
38 | include: [resolve('src'), resolve('test')]
39 | },
40 | {
41 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
42 | loader: 'url-loader',
43 | options: {
44 | limit: 10000,
45 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
46 | }
47 | },
48 | {
49 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
50 | loader: 'url-loader',
51 | options: {
52 | limit: 10000,
53 | name: utils.assetsPath('media/[name].[hash:7].[ext]')
54 | }
55 | },
56 | {
57 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
58 | loader: 'url-loader',
59 | options: {
60 | limit: 10000,
61 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
62 | }
63 | }
64 | // { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") }
65 | ]
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var utils = require('./utils')
2 | var webpack = require('webpack')
3 | var config = require('../config')
4 | var merge = require('webpack-merge')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
8 |
9 | // add hot-reload related code to entry chunks
10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
12 | })
13 |
14 | module.exports = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
17 | },
18 | // cheap-module-eval-source-map is faster for development
19 | devtool: '#cheap-module-eval-source-map',
20 | plugins: [
21 | new webpack.DefinePlugin({
22 | 'process.env': config.dev.env
23 | }),
24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
25 | new webpack.HotModuleReplacementPlugin(),
26 | new webpack.NoEmitOnErrorsPlugin(),
27 | // https://github.com/ampedandwired/html-webpack-plugin
28 | new HtmlWebpackPlugin({
29 | filename: 'index.html',
30 | template: 'index.html',
31 | inject: true
32 | }),
33 | new FriendlyErrorsPlugin()
34 | ]
35 | })
36 |
--------------------------------------------------------------------------------
/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var utils = require('./utils')
3 | var webpack = require('webpack')
4 | var config = require('../config')
5 | var merge = require('webpack-merge')
6 | var baseWebpackConfig = require('./webpack.base.conf')
7 | var CopyWebpackPlugin = require('copy-webpack-plugin')
8 | var HtmlWebpackPlugin = require('html-webpack-plugin')
9 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
11 |
12 | var env = config.build.env
13 |
14 | var webpackConfig = merge(baseWebpackConfig, {
15 | module: {
16 | rules: utils.styleLoaders({
17 | sourceMap: config.build.productionSourceMap,
18 | extract: true
19 | })
20 | },
21 | devtool: config.build.productionSourceMap ? '#source-map' : false,
22 | // output: {
23 | // path: config.build.assetsRoot,
24 | // filename: utils.assetsPath('js/[name].[chunkhash].js'),
25 | // chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
26 | // },
27 | output: {
28 | path: config.bundle.assetsRoot,
29 | publicPath: config.bundle.assetsPublicPath,
30 | filename: 'vue-jLunar-datePicker.min.js',
31 | library: 'VueJLunarDatePicker',
32 | libraryTarget: 'umd'
33 | },
34 | plugins: [
35 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
36 | new webpack.DefinePlugin({
37 | 'process.env': env
38 | }),
39 | new webpack.optimize.UglifyJsPlugin({
40 | compress: {
41 | warnings: false
42 | },
43 | sourceMap: true
44 | }),
45 | // extract css into its own file
46 |
47 |
48 | new ExtractTextPlugin({
49 | filename: utils.assetsPath('css/[name].[contenthash].css')
50 | }),
51 |
52 |
53 | // Compress extracted CSS. We are using this plugin so that possible
54 | // duplicated CSS from different components can be deduped.
55 |
56 |
57 | new OptimizeCSSPlugin({
58 | cssProcessorOptions: {
59 | safe: true
60 | }
61 | }),
62 |
63 |
64 | // generate dist index.html with correct asset hash for caching.
65 | // you can customize output by editing /index.html
66 | // see https://github.com/ampedandwired/html-webpack-plugin
67 | // new HtmlWebpackPlugin({
68 | // filename: config.build.index,
69 | // template: 'index.html',
70 | // inject: true,
71 | // minify: {
72 | // removeComments: true,
73 | // collapseWhitespace: true,
74 | // removeAttributeQuotes: true
75 | // // more options:
76 | // // https://github.com/kangax/html-minifier#options-quick-reference
77 | // },
78 | // // necessary to consistently work with multiple chunks via CommonsChunkPlugin
79 | // chunksSortMode: 'dependency'
80 | // }),
81 | // // keep module.id stable when vender modules does not change
82 | // new webpack.HashedModuleIdsPlugin(),
83 | // // split vendor js into its own file
84 | // new webpack.optimize.CommonsChunkPlugin({
85 | // name: 'vendor',
86 | // minChunks: function (module, count) {
87 | // // any required modules inside node_modules are extracted to vendor
88 | // return (
89 | // module.resource &&
90 | // /\.js$/.test(module.resource) &&
91 | // module.resource.indexOf(
92 | // path.join(__dirname, '../node_modules')
93 | // ) === 0
94 | // )
95 | // }
96 | // }),
97 | // // extract webpack runtime and module manifest to its own file in order to
98 | // // prevent vendor hash from being updated whenever app bundle is updated
99 | // new webpack.optimize.CommonsChunkPlugin({
100 | // name: 'manifest',
101 | // chunks: ['vendor']
102 | // }),
103 | // // copy custom static assets
104 | // new CopyWebpackPlugin([
105 | // {
106 | // from: path.resolve(__dirname, '../static'),
107 | // to: config.build.assetsSubDirectory,
108 | // ignore: ['.*']
109 | // }
110 | // ])
111 | ]
112 | })
113 |
114 | // if (config.build.productionGzip) {
115 | // var CompressionWebpackPlugin = require('compression-webpack-plugin')
116 | //
117 | // webpackConfig.plugins.push(
118 | // new CompressionWebpackPlugin({
119 | // asset: '[path].gz[query]',
120 | // algorithm: 'gzip',
121 | // test: new RegExp(
122 | // '\\.(' +
123 | // config.build.productionGzipExtensions.join('|') +
124 | // ')$'
125 | // ),
126 | // threshold: 10240,
127 | // minRatio: 0.8
128 | // })
129 | // )
130 | // }
131 | //
132 | // if (config.build.bundleAnalyzerReport) {
133 | // var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
134 | // webpackConfig.plugins.push(new BundleAnalyzerPlugin())
135 | // }
136 |
137 | module.exports = webpackConfig
138 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css'],
18 | // Run the build command with an extra argument to
19 | // View the bundle analyzer report after build finishes:
20 | // `npm run build --report`
21 | // Set to `true` or `false` to always turn it on or off
22 | bundleAnalyzerReport: process.env.npm_config_report
23 | },
24 | bundle: {
25 | env: require('./prod.env'),
26 | assetsRoot: path.resolve(__dirname, '../dist'),
27 | assetsPublicPath: '/',
28 | assetsSubDirectory: '/',
29 | productionSourceMap: true,
30 | productionGzip: false,
31 | productionGzipExtensions: ['js', 'css'],
32 | bundleAnalyzerReport: process.env.npm_config_report
33 | },
34 | dev: {
35 | env: require('./dev.env'),
36 | port: 8080,
37 | autoOpenBrowser: true,
38 | assetsSubDirectory: 'static',
39 | assetsPublicPath: '/',
40 | proxyTable: {},
41 | // CSS Sourcemaps off by default because relative paths are "buggy"
42 | // with this option, according to the CSS-Loader README
43 | // (https://github.com/webpack/css-loader#sourcemaps)
44 | // In our experience, they generally work as expected,
45 | // just be aware of this issue when enabling this option.
46 | cssSourceMap: false
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/dist/static/fonts/iconfont.46c5e08.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/dist/static/fonts/iconfont.46c5e08.woff
--------------------------------------------------------------------------------
/dist/static/fonts/iconfont.5dd7124.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/dist/static/fonts/iconfont.5dd7124.ttf
--------------------------------------------------------------------------------
/dist/static/fonts/iconfont.d96bda3.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/dist/static/fonts/iconfont.d96bda3.eot
--------------------------------------------------------------------------------
/dist/static/img/iconfont.7d4ee51.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
320 |
--------------------------------------------------------------------------------
/dist/vue-jLunar-datePicker.min.css:
--------------------------------------------------------------------------------
1 | #app{margin:50px auto;padding-top:30px;width:70%}#app .tt{vertical-align:top;line-height:34px;padding:0 5px}.api{padding:20px 0;text-align:left;line-height:24px;font-size:14px;color:#555}.param{line-height:44px}.js{padding:10px;border:1px solid #e8edf0;background-color:#ecf1f4;border-radius:5px}table{text-align:center}
--------------------------------------------------------------------------------
/dist/vue-jLunar-datePicker.min.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///./src/App.vue"],"names":[],"mappings":"AACA,KACE,iBACA,iBACA,SAAU,CAEZ,SAAU,mBAAqB,iBAAmB,aAAc,CAEhE,KACE,eACA,gBACA,iBACA,eACA,UAAW,CAEb,OACE,gBAAkB,CAEpB,IACE,aACA,yBACA,yBACA,iBAAmB,CAErB,MAAO,iBAAkB","file":"vue-jLunar-datePicker.min.css","sourcesContent":["\n#app{\n margin:50px auto;\n padding-top:30px;\n width:70%;\n}\n#app .tt{ vertical-align: top; line-height: 34px; padding:0 5px;\n}\n.api{\n padding:20px 0;\n text-align: left;\n line-height: 24px;\n font-size: 14px;\n color:#555;\n}\n.param{\n line-height: 44px;\n}\n.js{\n padding:10px;\n border:1px solid #e8edf0;\n background-color: #ECF1F4;\n border-radius: 5px;\n}\ntable{ text-align: center\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/App.vue"],"sourceRoot":""}
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JDatePicker
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-jlunar-datepicker",
3 | "version": "2.3.2",
4 | "description": "农历日期组件",
5 | "author": "jinwen (hellsar@163.com)",
6 | "private": false,
7 | "main": "./src/components/JDatePicker.vue",
8 | "license": "MIT",
9 | "homepage": "https://github.com/tuhe32/vue-jLunar-datePicker",
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/tuhe32/vue-jLunar-datePicker"
13 | },
14 | "keywords": [
15 | "vue-jLunar-datePicker",
16 | "vue-jlunar-datepicker",
17 | "lunar",
18 | "datepicker",
19 | "vue"
20 | ],
21 | "scripts": {
22 | "dev": "node build/dev-server.js",
23 | "start": "node build/dev-server.js",
24 | "build": "node build/build.js"
25 | },
26 | "dependencies": {
27 | "moment": "^2.18.1",
28 | "vue": "^2.4.2"
29 | },
30 | "devDependencies": {
31 | "autoprefixer": "^7.1.2",
32 | "babel-core": "^6.22.1",
33 | "babel-loader": "^7.1.1",
34 | "babel-plugin-transform-runtime": "^6.22.0",
35 | "babel-preset-env": "^1.3.2",
36 | "babel-preset-stage-2": "^6.22.0",
37 | "babel-register": "^6.22.0",
38 | "chalk": "^2.0.1",
39 | "connect-history-api-fallback": "^1.3.0",
40 | "copy-webpack-plugin": "^4.0.1",
41 | "css-loader": "^0.28.0",
42 | "cssnano": "^3.10.0",
43 | "eventsource-polyfill": "^0.9.6",
44 | "express": "^4.14.1",
45 | "extract-text-webpack-plugin": "^2.0.0",
46 | "file-loader": "^0.11.1",
47 | "friendly-errors-webpack-plugin": "^1.1.3",
48 | "html-webpack-plugin": "^2.28.0",
49 | "http-proxy-middleware": "^0.17.3",
50 | "webpack-bundle-analyzer": "^2.2.1",
51 | "semver": "^5.3.0",
52 | "shelljs": "^0.7.6",
53 | "opn": "^5.1.0",
54 | "optimize-css-assets-webpack-plugin": "^2.0.0",
55 | "ora": "^1.2.0",
56 | "rimraf": "^2.6.0",
57 | "url-loader": "^0.5.8",
58 | "vue-loader": "^13.0.4",
59 | "vue-style-loader": "^3.0.1",
60 | "vue-template-compiler": "^2.4.2",
61 | "webpack": "^2.6.1",
62 | "webpack-dev-middleware": "^1.10.0",
63 | "webpack-hot-middleware": "^2.18.0",
64 | "webpack-merge": "^4.1.0"
65 | },
66 | "engines": {
67 | "node": ">= 4.0.0",
68 | "npm": ">= 3.0.0"
69 | },
70 | "browserslist": [
71 | "> 1%",
72 | "last 2 versions",
73 | "not ie <= 8"
74 | ]
75 | }
76 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
232 |
233 |
234 |
276 |
277 |
302 |
--------------------------------------------------------------------------------
/src/components/JDatePicker.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 闰
6 | 农
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
31 |
32 |
33 |
34 | 日
35 | 一
36 | 二
37 | 三
38 | 四
39 | 五
40 | 六
41 |
42 |
43 |
44 |
45 |
48 |
49 |
50 |
51 |
52 | 闰
53 | {{day.isToday?'今天':day.day}}
54 |
55 |
56 | {{day.lDate.festival[0]}}
57 | {{day.lDate.Term}}
58 |
59 | {{day.lDate.IMonthCn.replace('闰','')}}
60 | {{day.lDate.IDayCn}}
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
75 |
76 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
95 |
96 |
97 | - {{m + startYear -1}}
98 |
99 |
100 |
取 消
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
118 |
119 |
120 |
121 | 日
122 | 一
123 | 二
124 | 三
125 | 四
126 | 五
127 | 六
128 |
129 |
130 |
131 |
132 |
135 |
136 |
137 |
138 |
139 | 闰
140 | {{day.isToday?'今天':day.day}}
141 |
142 |
143 | {{day.lDate.festival[0]}}
144 | {{day.lDate.Term}}
145 |
146 | {{day.lDate.IMonthCn.replace('闰','')}}
147 | {{day.lDate.IDayCn}}
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
166 |
167 |
168 |
169 | 日
170 | 一
171 | 二
172 | 三
173 | 四
174 | 五
175 | 六
176 |
177 |
178 |
179 |
180 |
183 |
184 |
185 |
186 |
187 | 闰
188 | {{day.isToday?'今天':day.day}}
189 |
190 |
191 | {{day.lDate.festival[0]}}
192 | {{day.lDate.Term}}
193 |
194 | {{day.lDate.IMonthCn.replace('闰','')}}
195 | {{day.lDate.IDayCn}}
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
733 |
734 |
736 |
--------------------------------------------------------------------------------
/src/components/index.js:
--------------------------------------------------------------------------------
1 | import jDatePicker from './JDatePicker.vue' // 导入组件
2 | const jLunarDatePicker = {
3 | install(Vue, options) {
4 | Vue.component(jDatePicker.name, jDatePicker) // vuePayKeyboard.name 组件的name属性
5 | // 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已
6 | // Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用
7 | // 虽然没有明确规定用$开头 但是大家都默认遵守这个规定
8 | }
9 | }
10 | if (typeof window !== 'undefined' && window.Vue) {
11 | window.Vue.use(jLunarDatePicker);
12 | }
13 | export default jLunarDatePicker // 导出..
14 |
--------------------------------------------------------------------------------
/src/components/jDatePicker.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @1900-2100区间内的公历、农历互转
3 | * @charset UTF-8
4 | * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
5 | */
6 | const calendar = {
7 |
8 | /**
9 | * 农历1900-2100的润大小信息表
10 | * @Array Of Property
11 | * @return Hex
12 | */
13 | lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909
14 | 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919
15 | 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929
16 | 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939
17 | 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949
18 | 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959
19 | 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969
20 | 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979
21 | 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989
22 | 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,//1990-1999
23 | 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009
24 | 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019
25 | 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029
26 | 0x05aa0,0x076a3,0x096d0,0x04afb,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039
27 | 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049
28 | /**Add By JJonline@JJonline.Cn**/
29 | 0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059
30 | 0x0a2e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069
31 | 0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079
32 | 0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089
33 | 0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099
34 | 0x0d520],//2100
35 |
36 | /**
37 | * 公历每个月份的天数普通表
38 | * @Array Of Property
39 | * @return Number
40 | */
41 | solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],
42 |
43 | /**
44 | * 天干地支之天干速查表
45 | * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
46 | * @return Cn string
47 | */
48 | Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"],
49 |
50 | /**
51 | * 天干地支之地支速查表
52 | * @Array Of Property
53 | * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
54 | * @return Cn string
55 | */
56 | Zhi:["\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"],
57 |
58 | /**
59 | * 天干地支之地支速查表<=>生肖
60 | * @Array Of Property
61 | * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
62 | * @return Cn string
63 | */
64 | Animals:["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"],
65 |
66 | /**
67 | * 24节气速查表
68 | * @Array Of Property
69 | * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
70 | * @return Cn string
71 | */
72 | 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"],
73 |
74 | /**
75 | * 1900-2100各年的24节气日期速查表
76 | * @Array Of Property
77 | * @return 0x string For splice
78 | */
79 | sTermInfo:['9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f',
80 | '97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
81 | '97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa',
82 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f',
83 | 'b027097bd097c36b0b6fc9274c91aa','9778397bd19801ec9210c965cc920e','97b6b97bd19801ec95f8c965cc920f',
84 | '97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2','9778397bd197c36c9210c9274c91aa',
85 | '97b6b97bd19801ec95f8c965cc920e','97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2',
86 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec95f8c965cc920e','97bcf97c3598082c95f8e1cfcc920f',
87 | '97bd097bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e',
88 | '97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
89 | '97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722',
90 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f',
91 | '97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
92 | '97bcf97c359801ec95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
93 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd097bd07f595b0b6fc920fb0722',
94 | '9778397bd097c36b0b6fc9210c8dc2','9778397bd19801ec9210c9274c920e','97b6b97bd19801ec95f8c965cc920f',
95 | '97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
96 | '97b6b97bd19801ec95f8c965cc920f','97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
97 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e','97bd07f1487f595b0b0bc920fb0722',
98 | '7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
99 | '97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
100 | '97b6b97bd19801ec9210c965cc920e','97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
101 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf7f1487f531b0b0bb0b6fb0722',
102 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
103 | '97bcf7f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
104 | '97b6b97bd19801ec9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
105 | '9778397bd097c36b0b6fc9210c91aa','97b6b97bd197c36c9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722',
106 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
107 | '97b6b7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
108 | '9778397bd097c36b0b70c9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
109 | '7f0e397bd097c35b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
110 | '7f0e27f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
111 | '97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
112 | '9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
113 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
114 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9274c91aa',
115 | '97b6b7f0e47f531b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
116 | '9778397bd097c36b0b6fc9210c91aa','97b6b7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
117 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','977837f0e37f149b0723b0787b0721',
118 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c35b0b6fc9210c8dc2',
119 | '977837f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
120 | '7f0e397bd097c35b0b6fc9210c8dc2','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
121 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','977837f0e37f14998082b0787b06bd',
122 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
123 | '977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
124 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
125 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd',
126 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
127 | '977837f0e37f14998082b0723b06bd','7f07e7f0e37f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
128 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b0721',
129 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f595b0b0bb0b6fb0722','7f0e37f0e37f14898082b0723b02d5',
130 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f531b0b0bb0b6fb0722',
131 | '7f0e37f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
132 | '7f0e37f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
133 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35',
134 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
135 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f149b0723b0787b0721',
136 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0723b06bd',
137 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722','7f0e37f0e366aa89801eb072297c35',
138 | '7ec967f0e37f14998082b0723b06bd','7f07e7f0e37f14998083b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
139 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14898082b0723b02d5','7f07e7f0e37f14998082b0787b0721',
140 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66aa89801e9808297c35','665f67f0e37f14898082b0723b02d5',
141 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66a449801e9808297c35',
142 | '665f67f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
143 | '7f0e36665b66a449801e9808297c35','665f67f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
144 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35','665f67f0e37f1489801eb072297c35',
145 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722'],
146 |
147 | /**
148 | * 数字转中文速查表
149 | * @Array Of Property
150 | * @trans ['日','一','二','三','四','五','六','七','八','九','十']
151 | * @return Cn string
152 | */
153 | nStr1:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"],
154 |
155 | /**
156 | * 日期转农历称呼速查表
157 | * @Array Of Property
158 | * @trans ['初','十','廿','卅']
159 | * @return Cn string
160 | */
161 | nStr2:["\u521d","\u5341","\u5eff","\u5345"],
162 |
163 | /**
164 | * 月份转农历称呼速查表
165 | * @Array Of Property
166 | * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
167 | * @return Cn string
168 | */
169 | nStr3:["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"],
170 |
171 | /**
172 | * 农历节日
173 | */
174 | lunarFestival:{"1-1":"春节","1-15":"上元节","2-2":"龙抬头","5-5":"端午","7-7":"七夕","7-15":"中元节","8-15":"中秋","9-9":"重阳","10-15":"下元节","12-8":"腊八","12-23":"小年"},
175 | /**
176 | * 公历节日
177 | */
178 | solarFestival:{"1-1":"元旦","2-14":"情人节","3-8":"妇女节","3-12":"植树节","4-1":"愚人节","5-1":"劳动节","5-4":"青年节","6-1":"儿童节","7-1":"建党节","8-1":"建军节","9-10":"教师节","10-1":"国庆节","11-1":"万圣节","12-24":"平安夜","12-25":"圣诞节"},
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, sum = 348;
188 | for(i=0x8000; i>0x8; i>>=1) { sum += (calendar.lunarInfo[y-1900] & i)? 1: 0; }
189 | return(sum+calendar.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(calendar.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(calendar.leapMonth(y)) {
210 | return((calendar.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( (calendar.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(calendar.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 calendar.Gan[ganKey-1] + calendar.Zhi[zhiKey-1];
253 |
254 | },
255 |
256 | /**
257 | * 公历月、日判断所属星座
258 | * @param cMonth [description]
259 | * @param cDay [description]
260 | * @return Cn string
261 | */
262 | toAstro:function(cMonth,cDay) {
263 | 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";
264 | var arr = [20,19,21,21,21,22,23,23,23,23,22,22];
265 | return s.substr(cMonth*2 - (cDay < arr[cMonth-1] ? 2 : 0),2) + "\u5ea7";//座
266 | },
267 |
268 | /**
269 | * 传入offset偏移量返回干支
270 | * @param offset 相对甲子的偏移量
271 | * @return Cn string
272 | */
273 | toGanZhi:function(offset) {
274 | return calendar.Gan[offset%10] + calendar.Zhi[offset%12];
275 | },
276 |
277 | /**
278 | * 传入公历(!)y年获得该年第n个节气的公历日期
279 | * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
280 | * @return day Number
281 | * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
282 | */
283 | getTerm:function(y,n) {
284 | if(y<1900 || y>2100) {return -1;}
285 | if(n<1 || n>24) {return -1;}
286 | var _table = calendar.sTermInfo[y-1900];
287 | var _info = [
288 | parseInt('0x'+_table.substr(0,5)).toString() ,
289 | parseInt('0x'+_table.substr(5,5)).toString(),
290 | parseInt('0x'+_table.substr(10,5)).toString(),
291 | parseInt('0x'+_table.substr(15,5)).toString(),
292 | parseInt('0x'+_table.substr(20,5)).toString(),
293 | parseInt('0x'+_table.substr(25,5)).toString()
294 | ];
295 | var _calday = [
296 | _info[0].substr(0,1),
297 | _info[0].substr(1,2),
298 | _info[0].substr(3,1),
299 | _info[0].substr(4,2),
300 |
301 | _info[1].substr(0,1),
302 | _info[1].substr(1,2),
303 | _info[1].substr(3,1),
304 | _info[1].substr(4,2),
305 |
306 | _info[2].substr(0,1),
307 | _info[2].substr(1,2),
308 | _info[2].substr(3,1),
309 | _info[2].substr(4,2),
310 |
311 | _info[3].substr(0,1),
312 | _info[3].substr(1,2),
313 | _info[3].substr(3,1),
314 | _info[3].substr(4,2),
315 |
316 | _info[4].substr(0,1),
317 | _info[4].substr(1,2),
318 | _info[4].substr(3,1),
319 | _info[4].substr(4,2),
320 |
321 | _info[5].substr(0,1),
322 | _info[5].substr(1,2),
323 | _info[5].substr(3,1),
324 | _info[5].substr(4,2),
325 | ];
326 | return parseInt(_calday[n-1]);
327 | },
328 |
329 | /**
330 | * 传入农历数字月份返回汉语通俗表示法
331 | * @param lunar month
332 | * @return Cn string
333 | * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
334 | */
335 | toChinaMonth:function(m) { // 月 => \u6708
336 | if(m>12 || m<1) {return -1} //若参数错误 返回-1
337 | var s = calendar.nStr3[m-1];
338 | s+= "\u6708";//加上月字
339 | return s;
340 | },
341 |
342 | /**
343 | * 传入年份月份返回第n个星期日的日期数字
344 | * @param y 年份
345 | * @param m 月份
346 | * @param n 第几个星期日 ( 5>n>0的数字 一个月一般就4个星期日,最多5个)
347 | * @return 日期数字;3 = getSunday(2017,9,1); 九月的第一个星期日是3号;超出返回-1
348 | */
349 | getSunday(y,m,n){
350 | var d = new Date(y+'-' + m + '-1');
351 | var d2= new Date(y+'-'+(m+1)+'-1');
352 | d2.setDate(0);
353 | var maxDay = d2.getDate();//传入月份的最后一天
354 |
355 | var week = d.getDay();
356 | var first = 1;
357 | if(week>0) first = d.getDate() + (7 - week);
358 | var result = (n-1)*7 + first;
359 | if(result>maxDay) return -1;
360 | return result;
361 | },
362 | /**
363 | * 传入农历日期数字返回汉字表示法
364 | * @param lunar day
365 | * @return Cn string
366 | * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
367 | */
368 | toChinaDay:function(d){ //日 => \u65e5
369 | var s;
370 | switch (d) {
371 | case 10:
372 | s = '\u521d\u5341'; break;
373 | case 20:
374 | s = '\u4e8c\u5341'; break;
375 | break;
376 | case 30:
377 | s = '\u4e09\u5341'; break;
378 | break;
379 | default :
380 | s = calendar.nStr2[Math.floor(d/10)];
381 | s += calendar.nStr1[d%10];
382 | }
383 | return(s);
384 | },
385 |
386 | /**
387 | * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
388 | * @param y year
389 | * @return Cn string
390 | * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
391 | */
392 | getAnimal: function(y) {
393 | return calendar.Animals[(y - 4) % 12]
394 | },
395 | /**
396 | * 判断 当天为 此年的第几天
397 | * @param date
398 | * @returns {number}
399 | */
400 | getCyclical:function(date){
401 | var nowDate = new Date(date);
402 | var initTime = new Date(date);
403 | initTime.setMonth(0); // 本年初始月份
404 | initTime.setDate(1); // 本年初始时间
405 | var differenceVal = nowDate - initTime ; // 今天的时间减去本年开始时间,获得相差的时间
406 | return Math.ceil(differenceVal/(24*60*60*1000));
407 | },
408 | /**
409 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
410 | * @param y solar year
411 | * @param m solar month
412 | * @param d solar day
413 | * @return JSON object
414 | * @eg:console.log(calendar.solar2lunar(1987,11,01));
415 | */
416 | solar2lunar:function (y,m,d) { //参数区间1900.1.31~2100.12.31
417 | //年份限定、上限
418 | if(y<1900 || y>2100) {
419 | return -1;// undefined转换为数字变为NaN
420 | }
421 | //公历传参最下限
422 | if(y==1900&&m==1&&d<31) {
423 | return -1;
424 | }
425 | //未传参 获得当天
426 | if(!y) {
427 | var objDate = new Date();
428 | }else {
429 | var objDate = new Date(y,parseInt(m)-1,d)
430 | }
431 | var i, leap=0, temp=0;
432 | //修正ymd参数
433 | var y = objDate.getFullYear(),
434 | m = objDate.getMonth()+1,
435 | d = objDate.getDate();
436 | var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
437 | for(i=1900; i<2101 && offset>0; i++) {
438 | temp = calendar.lYearDays(i);
439 | offset -= temp;
440 | }
441 | if(offset<0) {
442 | offset+=temp; i--;
443 | }
444 |
445 | //是否今天
446 | var isTodayObj = new Date(),
447 | isToday = false;
448 | if(isTodayObj.getFullYear()==y && isTodayObj.getMonth()+1==m && isTodayObj.getDate()==d) {
449 | isToday = true;
450 | }
451 | //星期几
452 | var nWeek = objDate.getDay(),
453 | cWeek = calendar.nStr1[nWeek];
454 | //数字表示周几顺应天朝周一开始的惯例
455 | if(nWeek==0) {
456 | nWeek = 7;
457 | }
458 | //农历年
459 | var year = i;
460 | var leap = calendar.leapMonth(i); //闰哪个月
461 | var isLeap = false;
462 |
463 | //效验闰月
464 | for(i=1; i<13 && offset>0; i++) {
465 | //闰月
466 | if(leap>0 && i==(leap+1) && isLeap==false){
467 | --i;
468 | isLeap = true; temp = calendar.leapDays(year); //计算农历闰月天数
469 | }
470 | else{
471 | temp = calendar.monthDays(year, i);//计算农历普通月天数
472 | }
473 | //解除闰月
474 | if(isLeap==true && i==(leap+1)) { isLeap = false; }
475 | offset -= temp;
476 | }
477 | // 闰月导致数组下标重叠取反
478 | if(offset==0 && leap>0 && i==leap+1)
479 | {
480 | if(isLeap){
481 | isLeap = false;
482 | }else{
483 | isLeap = true; --i;
484 | }
485 | }
486 | if(offset<0)
487 | {
488 | offset += temp;
489 | --i;
490 | }
491 | //农历月
492 | var month = i;
493 | //农历日
494 | var day = offset +1;
495 | //天干地支处理
496 | var sm = m-1;
497 | var gzY = calendar.toGanZhiYear(year);
498 |
499 | // 当月的两个节气
500 | // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
501 | var firstNode = calendar.getTerm(y,(m*2-1));//返回当月「节」为几日开始
502 | var secondNode = calendar.getTerm(y,(m*2));//返回当月「节」为几日开始
503 |
504 | // 依据12节气修正干支月
505 | var gzM = calendar.toGanZhi((y-1900)*12+m+11);
506 | if(d>=firstNode) {
507 | gzM = calendar.toGanZhi((y-1900)*12+m+12);
508 | }
509 |
510 | //传入的日期的节气与否
511 | var isTerm = false;
512 | var Term = null;
513 | if(firstNode==d) {
514 | isTerm = true;
515 | Term = calendar.solarTerm[m*2-2];
516 | }
517 | if(secondNode==d) {
518 | isTerm = true;
519 | Term = calendar.solarTerm[m*2-1];
520 | }
521 | //日柱 当月一日与 1900/1/1 相差天数
522 | var dayCyclical = Date.UTC(y,sm,1,0,0,0,0)/86400000+25567+10;
523 | var gzD = calendar.toGanZhi(dayCyclical+d-1);
524 | //(年-1900) * 5 + (年-1900+3) / 4 + 9 + 当年年初起累积日数
525 | // var dayCyclical = (y-1900)*5 + (y-1900+3)/4 + 9 +(this.getCyclical(y+'-'+m+'-'+d))
526 | // var gzD = calendar.toGanZhi(dayCyclical-1);
527 | //该日期所属的星座
528 | var astro = calendar.toAstro(m,d);
529 | //该日期所有的节日
530 | var festival = [];
531 | //农历传统节日
532 | var lf = calendar.lunarFestival[month+'-'+day];
533 | if(lf != undefined && lf != null && lf != '') festival.push(lf);
534 | if(month==12 && (isLeap?day == calendar.leapDays(year):calendar.monthDays(month-1)==29?day == 30:day == 29)) festival.push('除夕');
535 |
536 | //公历节日
537 | var sf = calendar.solarFestival[m+'-'+d];
538 | if(sf != undefined && sf != null && sf != '') festival.push(sf);
539 | if(m==5 && d==calendar.getSunday(y,m,2)) festival.push('母亲节');
540 | if(m==6 && d==calendar.getSunday(y,m,3)) festival.push('父亲节');
541 |
542 | return {'lYear':year,'lMonth':month,'lDay':day,'isFestival':festival.length>0,'festival':festival,'Animal':calendar.getAnimal(year),'IMonthCn':(isLeap?"\u95f0":'')+calendar.toChinaMonth(month),'IDayCn':calendar.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};
543 | },
544 |
545 | getLunar:function (date) {
546 | var D;
547 | if(date==undefined){
548 | D = new Date();
549 | }else{
550 | D = new Date(date);
551 | }
552 | D.setHours(D.getHours()+8)//根据国际UTC标准,中国时区应为:UTC+8
553 | var cY = D.getUTCFullYear();
554 | var cM = D.getUTCMonth()+1;
555 | var cD = D.getUTCDate();
556 | //console.log('getLunar:月'+cM+'--'+cD+'日')
557 | return calendar.solar2lunar(cY,cM,cD);
558 | },
559 |
560 | /**
561 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
562 | * @param y lunar year
563 | * @param m lunar month
564 | * @param d lunar day
565 | * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
566 | * @return JSON object
567 | * @eg:console.log(calendar.lunar2solar(1987,9,10));
568 | */
569 | lunar2solar:function(y,m,d,isLeapMonth) { //参数区间1900.1.31~2100.12.1
570 | var isLeapMonth = !!isLeapMonth;
571 | var leapOffset = 0;
572 | var leapMonth = calendar.leapMonth(y);
573 | var leapDay = calendar.leapDays(y);
574 | if(isLeapMonth&&(leapMonth!=m)) {return -1;}//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
575 | if(y==2100&&m==12&&d>1 || y==1900&&m==1&&d<31) {return -1;}//超出了最大极限值
576 | var day = calendar.monthDays(y,m);
577 | var _day = day;
578 | //bugFix 2016-9-25
579 | //if month is leap, _day use leapDays method
580 | if(isLeapMonth) {
581 | _day = calendar.leapDays(y,m);
582 | }
583 | if(y < 1900 || y > 2100 || d > _day) {return -1;}//参数合法性效验
584 |
585 | //计算农历的时间差
586 | var offset = 0;
587 | for(var i=1900;i0) {
595 | offset+=calendar.leapDays(y);isAdd = true;
596 | }
597 | }
598 | offset+=calendar.monthDays(y,i);
599 | }
600 | //转换闰月农历 需补充该年闰月的前一个月的时差
601 | if(isLeapMonth) {offset+=day;}
602 | //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
603 | var stmap = Date.UTC(1900,1,30,0,0,0);
604 | var calObj = new Date((offset+d-31)*86400000+stmap);
605 | var cY = calObj.getUTCFullYear();
606 | var cM = calObj.getUTCMonth()+1;
607 | var cD = calObj.getUTCDate();
608 |
609 | return calendar.solar2lunar(cY,cM,cD);
610 | },
611 | /**
612 | * 传入农历日期
613 | * @param date 类型String,格式:L2017-01-02;闰月:LR2017-06-03
614 | * @returns {*|JSON}
615 | */
616 | getSolar(date) {
617 | if(date == undefined || date == null || date == '' || date.indexOf('L') == -1) return null;
618 | var isLeapMonth = date.indexOf('R')>-1;
619 | var D = date.replace(/L/,'').replace(/R/,'').split('-');
620 | var cY = parseInt(D[0]);
621 | var cM = parseInt(D[1]);
622 | var cD = parseInt(D[2]);
623 | return calendar.lunar2solar(cY,cM,cD,isLeapMonth);
624 | },
625 | };
626 | export default { calendar }
627 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import App from './App'
5 |
6 | Vue.config.productionTip = false
7 | new Vue({
8 | el: '#app',
9 | template: '',
10 | components: { App }
11 | });
12 |
13 |
14 | // import Vue from 'vue'
15 | // import App from './App'
16 |
17 |
18 | // import vuePayKeyboard from './lib/indexvue-pay-keyboard'
19 |
20 |
21 |
22 | // import VueJLunarDatePicker from './components/index.js'
23 | // Vue.use(VueJLunarDatePicker)
24 | // import VueJLunarDatePicker from '@/components/JDatePicker.vue'
25 | // export default VueJLunarDatePicker;
26 |
--------------------------------------------------------------------------------
/src/theme/font/iconfont/iconfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/src/theme/font/iconfont/iconfont.eot
--------------------------------------------------------------------------------
/src/theme/font/iconfont/iconfont.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
320 |
--------------------------------------------------------------------------------
/src/theme/font/iconfont/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/src/theme/font/iconfont/iconfont.ttf
--------------------------------------------------------------------------------
/src/theme/font/iconfont/iconfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/src/theme/font/iconfont/iconfont.woff
--------------------------------------------------------------------------------
/src/theme/public.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 | @font-face {
3 | font-family: 'iconfont';
4 | src: url('font/iconfont/iconfont.eot?t=1492242939353'); /* IE9*/
5 | src: url('font/iconfont/iconfont.eot?t=1492242939353#iefix') format('embedded-opentype'), /* IE6-IE8 */
6 | url('font/iconfont/iconfont.woff?t=1492242939353') format('woff'), /* chrome, firefox */
7 | url('font/iconfont/iconfont.ttf?t=1492242939353') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
8 | url('font/iconfont/iconfont.svg?t=1492242939353#iconfont') format('svg'); /* iOS 4.1- */
9 | }
10 |
11 | .iconfont {
12 | font-family:"iconfont" !important;
13 | font-size:16px;
14 | font-style:normal;
15 | -webkit-font-smoothing: antialiased;
16 | -moz-osx-font-smoothing: grayscale;
17 | }
18 |
19 | .icon-time:before { content: "\e62f"; }
20 | .icon-richeng:before { content: "\e641"; }
21 | .icon-guanbi:before { content: "\e617"; }
22 |
23 | .icon-xiangzuojiantou:before { content: "\e660"; }
24 | .icon-xiangyoujiantou:before { content: "\e65f"; }
25 |
26 |
27 | body {
28 | margin: 0px;
29 | padding: 0px;
30 | /*background: url(assets/bg1.jpg) center !important;
31 | background-size: cover;*/
32 | background: #ffffff;
33 | font-size: 12px;
34 | -webkit-font-smoothing: antialiased;
35 | }
36 | body, button, input, select, textarea {
37 | font: 400 1em/1.5 PingFang SC,/*Lantinghei SC,Helvetica Neue,*/Microsoft Yahei,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans;
38 | }
39 | ul,li,dl,dt,dd{ margin:0; padding:0; list-style:none;}
40 | em,i{ font-style:normal; margin:0; padding:0;}
41 | h1,h2,h3,h4,h5,p{ margin:0; padding:0;}
42 | a{ cursor: pointer;}
43 |
44 |
45 | .full-jcalendar{
46 | position: relative;
47 | font-size: 14px;
48 | display: inline-block;
49 | }
50 | .full-jcalendar .input-icon{
51 | position: absolute;
52 | width: 28px;
53 | height: 100%;
54 | right: 0;
55 | top: 5px;
56 | text-align: center;
57 | color: #e8a400;
58 | transition: all .3s;
59 | }
60 | .full-jcalendar .input-icon .iconfont{
61 | font-size: 18px;
62 | }
63 | .full-jcalendar .input-icon .iconfont.is-clear{
64 | color:#999;
65 | font-weight: bolder;
66 | }
67 | .full-jcalendar .input-icon__tip{
68 | position: absolute;
69 | right:28px;
70 | top:10px;
71 | width:16px;
72 | cursor: default;
73 | text-align: center;
74 | }
75 | .full-jcalendar .input-icon__tip i{
76 | display: block;
77 | margin:0;
78 | padding:0;
79 | width:16px;
80 | height:16px;
81 | background-color: #ff5a00;
82 | border-radius: 8px;
83 | font-size: 12px;
84 | color:#fff;
85 | line-height: 16px;
86 | text-align: center;
87 | overflow: hidden;
88 | }
89 |
90 | .full-jcalendar .input__inner{
91 | -webkit-appearance: none;
92 | -moz-appearance: none;
93 | appearance: none;
94 | background-color: #fff;
95 | background-image: none;
96 | border-radius: 5px;
97 | border: 1px solid #bfcbd9;
98 | box-sizing: border-box;
99 | color: #1f2d3d;
100 | display: inline-block;
101 | font-size: inherit;
102 | height: 36px;
103 | line-height: 1;
104 | outline: none;
105 | padding: 3px 10px;
106 | transition: border-color .2s cubic-bezier(.645,.045,.355,1);
107 | min-width:193px;
108 | width: 100%;
109 | }
110 | .full-jcalendar .input__inner:focus{
111 | outline: none;
112 | border-color:#20a0ff;
113 | }
114 | .full-jcalendar .input__inner:hover{
115 | border-color:#8391a5;
116 | }
117 | .input-icon+.input__inner{
118 | padding-right:28px;
119 | }
120 | .input-icon__tip+.input__inner{
121 | padding-right:35px;
122 | }
123 | .full-jcalendar input.input__inner::placeholder, .full-jcalendar input.input__inner:-moz-placeholder{
124 | color:#97A8BE;
125 | }
126 | .full-jcalendar input.is-disabled{
127 | background-color: #eef1f6;
128 | border-color: #d1dbe5;
129 | color: #bbb;
130 | cursor: not-allowed;
131 | }
132 | .full-jcalendar .is-disabled i{
133 | color: #bbb;
134 | }
135 | .full-jcalendar .is-disabled *{
136 | cursor: not-allowed;
137 | }
138 |
139 | .full-jcalendar__main{
140 | cursor: pointer;
141 | position: absolute;
142 | z-index: 1670;
143 | left:2px;
144 | top:38px;
145 | width:296px;
146 | background-color: #ffffff;
147 | border-radius: 5px;
148 | -moz-box-shadow:2px 2px 5px #C9C9C9;
149 | -webkit-box-shadow:2px 2px 5px #C9C9C9;
150 | box-shadow:2px 2px 5px #C9C9C9;
151 | overflow: hidden;
152 | }
153 | .full-jcalendar__main.is-daterange{
154 | width:593px;
155 | }
156 | .full-jcalendar__main .date-range__month{
157 | float: left;
158 | width:296px;
159 | overflow: hidden;
160 | }
161 | .full-jcalendar__main .date-range__month.leftMonth{
162 | border-right:1px solid #F8F8F8;
163 | }
164 | .full-jcalendar-header{
165 | position: relative;
166 | width:100%;
167 | padding:5px 0;
168 | height:24px;
169 | font-size: 14px;
170 | text-align: center;
171 | line-height: 24px;
172 | color:#333;
173 | }
174 | .full-jcalendar-header span{ display: inline-block;}
175 | .full-jcalendar-header .title-year:hover,.full-jcalendar-header .title-month:hover{
176 | color:#50bfff;
177 | }
178 | .date-range__month .full-jcalendar-header .title-year:hover,.date-range__month .full-jcalendar-header .title-month:hover{
179 | color:#333;
180 | }
181 | .full-jcalendar-header .prev-month,.full-jcalendar-header .next-month {
182 | cursor: pointer;
183 | line-height: 20px;
184 | text-align: center;
185 | color: #E1CEB7;
186 | font-size: 20px;
187 | }
188 | .full-jcalendar-header p.prev-month{
189 | position: absolute;
190 | z-index: 1676;
191 | left:5px;
192 | top:5px;
193 | }
194 | .full-jcalendar-header p.next-month {
195 | position: absolute;
196 | z-index: 1676;
197 | right: 5px;
198 | top: 5px;
199 | }
200 |
201 | .date-range__month .full-jcalendar-header .prev-year{
202 | position: absolute;
203 | z-index: 1676;
204 | left: 5px;
205 | top: 5px;
206 | }
207 |
208 | .date-range__month .full-jcalendar-header .prev-month{
209 | left:35px;
210 | }
211 | .date-range__month .full-jcalendar-header .next-year{
212 | position: absolute;
213 | z-index: 1676;
214 | right: 5px;
215 | top: 5px;
216 | }
217 | .date-range__month .full-jcalendar-header .next-month{
218 | right:35px;
219 | }
220 |
221 | .full-jcalendar__body {
222 | margin: 0;
223 | padding: 0;
224 | width: 100%;
225 | height: 280px;
226 | position: relative;
227 | }
228 | .full-jcalendar__body ul,.full-jcalendar__body p {
229 | margin: 0;
230 | padding: 0;
231 | }
232 | .full-jcalendar__body .weeks {
233 | width: 100%;
234 | height: 30px;
235 | display: flex;
236 | border-top: 1px solid #F8F8F8;
237 | }
238 | .full-jcalendar__body .weeks .week {
239 | flex: 1;
240 | text-align: center;
241 | font-size: 14px;
242 | color: #8391A5;
243 | line-height: 30px;
244 | border: none;
245 | }
246 | .full-jcalendar__body .weeks .week strong {
247 | font-weight: normal;
248 | }
249 | .full-jcalendar__body .week-row {
250 | display: flex;
251 | width:100%;
252 | }
253 | .full-jcalendar__body .week-row .day-cell {
254 | position: relative;
255 | flex: 1;
256 | padding: 2px;
257 | border: 1px solid #F8F8F8;
258 | margin-right: -1px;
259 | margin-bottom: -1px;
260 | text-align: center;
261 | }
262 | .full-jcalendar__body .day-cell .day-number .lunar {
263 | font-size: 12px;
264 | color: #ACACAC;
265 | }
266 | .full-jcalendar__body .day-cell .day-number .solar {
267 | font-size: 12px;
268 | color: #483a32;
269 | /*text-shadow: 1px 1px 1px #ddd;*/
270 | }
271 | /*.full-jcalendar__body .day-cell.not-cur-month .solar {*/
272 | /*text-shadow: none;*/
273 | /*}*/
274 | .full-jcalendar__body .day-cell .day-number .solar .is-leap {
275 | display: inline-block;
276 | width:14px;
277 | height:14px;
278 | border-radius: 7px;
279 | background-color: #f00;
280 | font-size: 12px;
281 | color: #fff;
282 | text-align: center;
283 | line-height: 14px;
284 | }
285 | .full-jcalendar__body .day-cell .day-number .term {
286 | font-size:12px;
287 | color: #FFC200;
288 | }
289 | .full-jcalendar__body .day-cell .day-number .festival {
290 | font-size:12px;
291 | color: #ff8610;
292 | }
293 | .full-jcalendar__body .day-cell .day-number .is-today {
294 | font-size: 12px;
295 | color: #20a0ff;
296 | }
297 | .full-jcalendar__body .day-cell .day-number .is-empty {
298 | line-height: 34px;
299 | }
300 | .full-jcalendar__body .day-cell.today {
301 | background-color: #FBF9F6;
302 | }
303 | .full-jcalendar__body .day-cell.today:before {
304 | content: " ";
305 | position: absolute;
306 | top: 0;
307 | right: 0;
308 | width: 0;
309 | height: 0;
310 | border-top: .5em solid #20a0ff;
311 | border-left: .5em solid transparent;
312 | }
313 | .full-jcalendar__body .day-cell.choose {
314 | background-color: #d2ecff;
315 | }
316 | .full-jcalendar__body .day-cell.select {
317 | background-color: #009bfe;
318 | }
319 | .full-jcalendar__body .day-cell.select .lunar,
320 | .full-jcalendar__body .day-cell.select .solar,
321 | .full-jcalendar__body .day-cell.select .term ,
322 | .full-jcalendar__body .day-cell.select .festival ,
323 | .full-jcalendar__body .day-cell.select .is-today{
324 | color: #fff;
325 | }
326 | .full-jcalendar__body .day-cell.select .solar .is-leap {
327 | background: none;
328 | }
329 | .full-jcalendar__body .day-cell.not-cur-month .lunar
330 | ,.full-jcalendar__body .day-cell.not-cur-month .solar
331 | ,.full-jcalendar__body .day-cell.not-cur-month .term
332 | ,.full-jcalendar__body .day-cell.not-cur-month .festival{
333 | color: #ddd;
334 | }
335 | .full-jcalendar__body .day-cell:hover {
336 | background-color: #ECF1F4;
337 | }
338 | .full-jcalendar__body .day-cell.choose:hover {
339 | background-color: #009bfe;
340 | }
341 | .full-jcalendar__body .day-cell.choose:hover .lunar,
342 | .full-jcalendar__body .day-cell.choose:hover .solar,
343 | .full-jcalendar__body .day-cell.choose:hover .term ,
344 | .full-jcalendar__body .day-cell.choose:hover .festival ,
345 | .full-jcalendar__body .day-cell.choose:hover .is-today{
346 | color: #fff;
347 | }
348 | .full-jcalendar__body .select:hover{
349 | background-color: #009bfe;
350 | }
351 | .full-jcalendar__body .day-cell.not-optional{
352 | background-color: #ECF1F4;
353 | }
354 | .full-jcalendar__month,.full-jcalendar__year{
355 | position: absolute;
356 | z-index: 1677;
357 | top:0;
358 | left:0;
359 | width:100%;
360 | height:100%;
361 | background-color: #fff;
362 | }
363 | .full-jcalendar__body .close{
364 | position: absolute;
365 | bottom:10px;
366 | right:10px;
367 | padding:3px 5px;
368 | font-size:12px;
369 | background-color: #FBF8FF;
370 | border:1px solid #F8F8F8;
371 | border-radius: 3px;
372 | }
373 | .full-jcalendar__body .data-list{
374 | list-style: none;
375 | margin:auto;
376 | padding:20px 0 0 0;
377 | width:85%;
378 | }
379 | .full-jcalendar__body .data-list li{
380 | position: relative;
381 | list-style: none;
382 | line-height: normal;
383 | float: left;
384 | width:25%;
385 | text-align: center;
386 | padding:5px 0;
387 | margin:10px 0;
388 | font-size:14px;
389 | color:#333;
390 | }
391 | .full-jcalendar__body .data-list li:hover ,.full-jcalendar__body .data-list li.select-year {
392 | background-color: #50bfff;
393 | color: #fff;
394 | }
395 | .full-jcalendar__body .data-list li.curr-year:before {
396 | content: " ";
397 | position: absolute;
398 | top: 0;
399 | right: 0;
400 | width: 0;
401 | height: 0;
402 | border-top: .5em solid #20a0ff;
403 | border-left: .5em solid transparent;
404 | }
405 | .full-jcalendar__body .clearfix{
406 | float: none;
407 | width:100%;
408 | clear: both;
409 | height:0px;
410 | line-height: 0px;
411 | }
412 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/static/.gitkeep
--------------------------------------------------------------------------------
/static/DEMO.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tuhe32/vue-jLunar-datePicker/7ccc04e8a400b803b36efc6ad365b29a5ee2ab11/static/DEMO.png
--------------------------------------------------------------------------------