1
+ const $libraryName = 'lxy_lunar_calender_library'
2
+
3
+ const UtilsLogics = { }
4
+ import getLunar from './getLunar'
5
+ import getSolar from './getSolar'
6
+ import getMonthInChinese from './getMonthInChinese'
7
+ import getJieQi from './getJieQi'
8
+ import getLeapMonth from './getLeapMonth'
9
+ import getYearShengXiao from './getYearShengXiao'
10
+ import isFestivals from './isFestivals'
11
+ import getLunarDiff from './getLunarDiff'
12
+ import isFestivalsByLunar from './isFestivalsByLunar'
13
+ // LOGIC IMPORTS
14
+
15
+ UtilsLogics . install = function ( Vue , option = { } ) {
16
+ Vue . prototype . $library = Vue . prototype . $library || { }
17
+ Vue . prototype . $library [ `${ $libraryName } ` ] = { }
18
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getLunar = getLunar
19
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getSolar = getSolar
20
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getMonthInChinese = getMonthInChinese
21
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getJieQi = getJieQi
22
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getLeapMonth = getLeapMonth
23
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getYearShengXiao = getYearShengXiao
24
+ Vue . prototype . $library [ `${ $libraryName } ` ] . isFestivals = isFestivals
25
+ Vue . prototype . $library [ `${ $libraryName } ` ] . getLunarDiff = getLunarDiff
26
+ Vue . prototype . $library [ `${ $libraryName } ` ] . isFestivalsByLunar = isFestivalsByLunar
27
+ // LOGIC USE
28
+ }
29
+
30
+ /* 阴转阳 */
31
+ console . log ( getSolar ( "一九八六年四月廿一" ) ) // 1986-05-29
32
+ /* 阳转阴 */
33
+ console . log ( getLunar ( "1998-10" ) ) ; // 一九九八年八月十一
34
+ /* 转阴历月份 */
35
+ console . log ( getMonthInChinese ( "1998-10" ) ) ; // 八
36
+ /* 获取阴历节气信息 */
37
+ console . log ( getJieQi ( "2024-2-4" ) ) ; // 立春
38
+ /* 获取闰月 */
39
+ console . log ( getLeapMonth ( "2024-2-4" ) ) ; // 2
40
+ /* 获取生肖 */
41
+ console . log ( '获取生肖' , getYearShengXiao ( "2024-2-4" ) ) ; // 兔
42
+ /* 获取节日 */
43
+ console . log ( '是否节日' , isFestivals ( "2024-2-12" ) ) ; // 是
44
+ /* 阴历是否节日 */
45
+ console . log ( '阴历是否节日' , isFestivalsByLunar ( "二零二四年正月初一" ) ) ; // 是
46
+ /* 获取阴历天数差 */
47
+ console . log ( '天数差' , getLunarDiff ( '一九八六年四月廿一' , '一九八六年四月廿九' ) ) ; // 是
48
+
49
+
50
+ export default UtilsLogics
0 commit comments