hy-app 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +1 -1
  2. package/api/http.ts +8 -8
  3. package/components/dialog/index.ts +2 -2
  4. package/components/hy-address-picker/hy-address-picker.vue +3 -29
  5. package/components/hy-address-picker/index.scss +27 -0
  6. package/components/hy-avatar/hy-avatar.vue +1 -45
  7. package/components/hy-avatar/index.scss +45 -0
  8. package/components/hy-avatar/typing.d.ts +1 -1
  9. package/components/hy-back-top/hy-back-top.vue +7 -22
  10. package/components/hy-back-top/index.scss +16 -0
  11. package/components/hy-back-top/props.ts +4 -4
  12. package/components/hy-back-top/typing.d.ts +2 -3
  13. package/components/hy-badge/hy-badge.vue +1 -72
  14. package/components/hy-badge/index.scss +72 -0
  15. package/components/hy-button/hy-button.vue +12 -124
  16. package/components/hy-button/index.scss +116 -0
  17. package/components/hy-calendar/header.vue +76 -0
  18. package/components/hy-calendar/hy-calendar.vue +366 -0
  19. package/components/hy-calendar/index.scss +171 -0
  20. package/components/hy-calendar/month.vue +524 -0
  21. package/components/hy-calendar/props.ts +37 -0
  22. package/components/hy-calendar/typing.d.ts +126 -0
  23. package/components/hy-card/hy-card.vue +21 -84
  24. package/components/hy-card/index.scss +57 -0
  25. package/components/hy-card/props.ts +2 -2
  26. package/components/hy-card/typing.d.ts +1 -1
  27. package/components/hy-cell/hy-cell.vue +1 -137
  28. package/components/hy-cell/index.scss +137 -0
  29. package/components/hy-check-button/hy-check-button.vue +1 -0
  30. package/components/hy-check-button/index.scss +5 -0
  31. package/components/hy-checkbox/hy-checkbox.vue +2 -95
  32. package/components/hy-checkbox/index.scss +94 -0
  33. package/components/hy-checkbox/typing.d.ts +1 -2
  34. package/components/hy-count-down/hy-count-down.vue +150 -0
  35. package/components/hy-count-down/index.scss +6 -0
  36. package/components/hy-count-down/index.ts +52 -0
  37. package/components/hy-count-down/props.ts +10 -0
  38. package/components/hy-count-down/typing.d.ts +20 -0
  39. package/components/hy-count-to/hy-count-to.vue +213 -0
  40. package/components/hy-count-to/index.scss +6 -0
  41. package/components/hy-count-to/props.ts +17 -0
  42. package/components/hy-count-to/typing.d.ts +48 -0
  43. package/components/hy-datetime-picker/hy-datetime-picker.vue +2 -28
  44. package/components/hy-datetime-picker/index.scss +28 -0
  45. package/components/hy-divider/hy-divider.vue +24 -49
  46. package/components/hy-divider/index.scss +25 -0
  47. package/components/hy-divider/props.ts +2 -2
  48. package/components/hy-divider/typing.d.ts +1 -1
  49. package/components/hy-dropdown/hy-dropdown.vue +43 -0
  50. package/components/hy-dropdown/index.scss +17 -0
  51. package/components/hy-dropdown/props.ts +17 -0
  52. package/components/hy-dropdown/typing.d.ts +48 -0
  53. package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
  54. package/components/hy-dropdown-item/index.scss +96 -0
  55. package/components/hy-dropdown-item/props.ts +10 -0
  56. package/components/hy-dropdown-item/typing.d.ts +31 -0
  57. package/components/hy-empty/hy-empty.vue +8 -26
  58. package/components/hy-empty/index.scss +19 -0
  59. package/components/hy-empty/props.ts +2 -2
  60. package/components/hy-empty/typing.d.ts +1 -1
  61. package/components/hy-float-button/hy-float-button.vue +201 -0
  62. package/components/hy-float-button/index.scss +69 -0
  63. package/components/hy-float-button/props.ts +25 -0
  64. package/components/hy-float-button/typing.d.ts +93 -0
  65. package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
  66. package/components/hy-folding-panel/index.scss +6 -0
  67. package/components/hy-folding-panel/props.ts +2 -2
  68. package/components/hy-folding-panel/typing.d.ts +2 -2
  69. package/components/hy-form/hy-form.vue +17 -34
  70. package/components/hy-form/index.scss +30 -0
  71. package/components/hy-form/props.ts +2 -0
  72. package/components/hy-form/typing.d.ts +9 -1
  73. package/components/hy-grid/hy-grid.vue +1 -43
  74. package/components/hy-grid/index.scss +40 -0
  75. package/components/hy-icon/hy-icon.vue +1 -93
  76. package/components/hy-icon/index.scss +84 -0
  77. package/components/hy-image/hy-image.vue +212 -0
  78. package/components/hy-image/index.scss +26 -0
  79. package/components/hy-image/props.ts +24 -0
  80. package/components/hy-image/typing.d.ts +76 -0
  81. package/components/hy-input/hy-input.vue +2 -72
  82. package/components/hy-input/index.scss +65 -0
  83. package/components/hy-line/hy-line.vue +4 -8
  84. package/components/hy-line/index.scss +5 -0
  85. package/components/hy-line/props.ts +3 -3
  86. package/components/hy-line/typing.d.ts +2 -2
  87. package/components/hy-line-progress/hy-line-progress.vue +15 -44
  88. package/components/hy-line-progress/index.scss +38 -0
  89. package/components/hy-line-progress/props.ts +2 -2
  90. package/components/hy-line-progress/typing.d.ts +1 -1
  91. package/components/hy-list/hy-list.vue +11 -41
  92. package/components/hy-list/index.scss +32 -0
  93. package/components/hy-list/props.ts +2 -2
  94. package/components/hy-loading/hy-loading.vue +95 -0
  95. package/components/hy-loading/index.scss +103 -0
  96. package/components/hy-loading/props.ts +17 -0
  97. package/components/hy-loading/typing.d.ts +52 -0
  98. package/components/hy-login/TheUserLogin.vue +16 -16
  99. package/components/hy-login/hy-login.vue +9 -9
  100. package/components/hy-login/props.ts +4 -4
  101. package/components/hy-modal/hy-modal.vue +11 -89
  102. package/components/hy-modal/index.scss +77 -0
  103. package/components/hy-modal/props.ts +2 -2
  104. package/components/hy-modal/typing.d.ts +1 -1
  105. package/components/hy-navbar/hy-navbar.vue +20 -92
  106. package/components/hy-navbar/index.scss +67 -0
  107. package/components/hy-navbar/props.ts +2 -2
  108. package/components/hy-navbar/typing.d.ts +1 -1
  109. package/components/hy-notice-bar/hy-column-notice.vue +11 -39
  110. package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
  111. package/components/hy-notice-bar/hy-row-notice.vue +5 -56
  112. package/components/hy-notice-bar/index.scss +93 -0
  113. package/components/hy-notice-bar/props.ts +4 -2
  114. package/components/hy-notice-bar/typing.d.ts +13 -3
  115. package/components/hy-number-step/hy-number-step.vue +1 -70
  116. package/components/hy-number-step/index.scss +71 -0
  117. package/components/hy-overlay/hy-overlay.vue +2 -14
  118. package/components/hy-overlay/index.scss +9 -0
  119. package/components/hy-picker/hy-picker.vue +1 -68
  120. package/components/hy-picker/index.scss +68 -0
  121. package/components/hy-popup/hy-popup.vue +1 -74
  122. package/components/hy-popup/index.scss +60 -0
  123. package/components/hy-price/hy-price.vue +1 -11
  124. package/components/hy-price/index.scss +11 -0
  125. package/components/hy-qrcode/hy-qrcode.vue +15 -37
  126. package/components/hy-qrcode/index.scss +23 -0
  127. package/components/hy-qrcode/props.ts +2 -2
  128. package/components/hy-qrcode/typing.d.ts +2 -2
  129. package/components/hy-radio/hy-radio.vue +2 -101
  130. package/components/hy-radio/index.scss +93 -0
  131. package/components/hy-radio/typing.d.ts +1 -2
  132. package/components/hy-rate/hy-rate.vue +1 -33
  133. package/components/hy-rate/index.scss +33 -0
  134. package/components/hy-read-more/hy-read-more.vue +7 -30
  135. package/components/hy-read-more/index.scss +25 -0
  136. package/components/hy-read-more/props.ts +3 -3
  137. package/components/hy-read-more/typing.d.ts +1 -1
  138. package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
  139. package/components/hy-safe-bottom/index.scss +5 -0
  140. package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
  141. package/components/hy-scroll-list/index.scss +34 -0
  142. package/components/hy-scroll-list/props.ts +2 -2
  143. package/components/hy-scroll-list/typing.d.ts +1 -1
  144. package/components/hy-search/hy-search.vue +1 -83
  145. package/components/hy-search/index.scss +83 -0
  146. package/components/hy-slider/hy-slider.vue +14 -92
  147. package/components/hy-slider/index.scss +77 -0
  148. package/components/hy-status-bar/hy-status-bar.vue +41 -0
  149. package/components/hy-status-bar/index.scss +6 -0
  150. package/components/hy-status-bar/props.ts +8 -0
  151. package/components/hy-status-bar/typing.d.ts +12 -0
  152. package/components/hy-steps/hy-steps.vue +36 -163
  153. package/components/hy-steps/index.scss +131 -0
  154. package/components/hy-steps/props.ts +2 -2
  155. package/components/hy-steps/typing.d.ts +2 -2
  156. package/components/hy-subsection/hy-subsection.vue +40 -132
  157. package/components/hy-subsection/index.scss +82 -0
  158. package/components/hy-subsection/props.ts +1 -0
  159. package/components/hy-subsection/typing.d.ts +13 -4
  160. package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
  161. package/components/hy-swipe-action/index.scss +9 -0
  162. package/components/hy-swipe-action/index.wxs +235 -0
  163. package/components/hy-swipe-action/props.ts +16 -0
  164. package/components/hy-swipe-action/typing.d.ts +55 -0
  165. package/components/hy-swipe-action/wxs.js +15 -0
  166. package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
  167. package/components/hy-swiper/hy-swiper.vue +1 -54
  168. package/components/hy-swiper/index.scss +82 -0
  169. package/components/hy-switch/hy-switch.vue +62 -72
  170. package/components/hy-switch/index.scss +46 -0
  171. package/components/hy-switch/props.ts +4 -1
  172. package/components/hy-switch/typing.d.ts +14 -1
  173. package/components/hy-tabs/hy-tabs.vue +22 -81
  174. package/components/hy-tabs/index.scss +63 -0
  175. package/components/hy-tabs/props.ts +5 -5
  176. package/components/hy-tabs/typing.d.ts +1 -1
  177. package/components/hy-tag/hy-tag.vue +1 -214
  178. package/components/hy-tag/index.scss +204 -0
  179. package/components/hy-text/hy-text.vue +238 -0
  180. package/components/hy-text/index.scss +70 -0
  181. package/components/hy-text/index.ts +0 -0
  182. package/components/hy-text/props.ts +30 -0
  183. package/components/hy-text/typing.d.ts +98 -0
  184. package/components/hy-textarea/hy-textarea.vue +1 -46
  185. package/components/hy-textarea/index.scss +40 -0
  186. package/components/hy-tooltip/hy-tooltip.vue +42 -95
  187. package/components/hy-tooltip/index.scss +64 -0
  188. package/components/hy-tooltip/props.ts +2 -2
  189. package/components/hy-tooltip/typing.d.ts +1 -1
  190. package/components/hy-transition/hy-transition.vue +4 -2
  191. package/components/hy-transition/typing.d.ts +1 -13
  192. package/components/hy-upload/hy-upload.vue +37 -182
  193. package/components/hy-upload/index.scss +147 -0
  194. package/components/hy-upload/props.ts +2 -2
  195. package/components/hy-upload/typing.d.ts +11 -11
  196. package/components/hy-warn/hy-warn.vue +15 -123
  197. package/components/hy-warn/index.scss +109 -0
  198. package/components/hy-warn/props.ts +3 -3
  199. package/components/hy-warn/typing.d.ts +4 -3
  200. package/components/hy-waterfall/index.scss +82 -0
  201. package/components/index.ts +25 -1
  202. package/components/message/index.ts +54 -54
  203. package/config/color.ts +2 -1
  204. package/global/index.ts +6 -6
  205. package/global/register-properties.ts +2 -2
  206. package/index.scss +2 -1
  207. package/libs/css/common.scss +14 -2
  208. package/package.json +2 -2
  209. package/{libs/css → public/font}/iconfont.css +4 -4
  210. package/theme.scss +6 -4
  211. package/typing/modules/common.d.ts +16 -1
  212. package/utils/calendar.js +1021 -0
  213. package/utils/colorGradient.ts +112 -0
  214. package/utils/index.ts +2 -0
  215. package/utils/inside.ts +80 -34
  216. package/utils/inspect.ts +66 -0
  217. package/utils/utils.ts +11 -12
  218. package/libs/css/download.zip +0 -0
  219. /package/{libs/css → public/font}/iconfont.ttf +0 -0
  220. /package/{libs/css → public/font}/iconfont.woff +0 -0
  221. /package/{libs/css → public/font}/iconfont.woff2 +0 -0
@@ -0,0 +1,1021 @@
1
+ /**
2
+ * @1900-2100区间内的公历、农历互转
3
+ * @charset UTF-8
4
+ * @github https://github.com/jjonline/calendar.js
5
+ * @Author Jea杨(JJonline@JJonline.Cn)
6
+ * @Time 2014-7-21
7
+ * @Time 2016-8-13 Fixed 2033hex、Attribution Annals
8
+ * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
9
+ * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
10
+ * @Version 1.0.3
11
+ * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
12
+ * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
13
+ */
14
+ /* eslint-disable */
15
+ var Calendar = {
16
+ /**
17
+ * 农历1900-2100的润大小信息表
18
+ * @Array Of Property
19
+ * @return Hex
20
+ */
21
+ lunarInfo: [
22
+ 0x04bd8,
23
+ 0x04ae0,
24
+ 0x0a570,
25
+ 0x054d5,
26
+ 0x0d260,
27
+ 0x0d950,
28
+ 0x16554,
29
+ 0x056a0,
30
+ 0x09ad0,
31
+ 0x055d2, // 1900-1909
32
+ 0x04ae0,
33
+ 0x0a5b6,
34
+ 0x0a4d0,
35
+ 0x0d250,
36
+ 0x1d255,
37
+ 0x0b540,
38
+ 0x0d6a0,
39
+ 0x0ada2,
40
+ 0x095b0,
41
+ 0x14977, // 1910-1919
42
+ 0x04970,
43
+ 0x0a4b0,
44
+ 0x0b4b5,
45
+ 0x06a50,
46
+ 0x06d40,
47
+ 0x1ab54,
48
+ 0x02b60,
49
+ 0x09570,
50
+ 0x052f2,
51
+ 0x04970, // 1920-1929
52
+ 0x06566,
53
+ 0x0d4a0,
54
+ 0x0ea50,
55
+ 0x06e95,
56
+ 0x05ad0,
57
+ 0x02b60,
58
+ 0x186e3,
59
+ 0x092e0,
60
+ 0x1c8d7,
61
+ 0x0c950, // 1930-1939
62
+ 0x0d4a0,
63
+ 0x1d8a6,
64
+ 0x0b550,
65
+ 0x056a0,
66
+ 0x1a5b4,
67
+ 0x025d0,
68
+ 0x092d0,
69
+ 0x0d2b2,
70
+ 0x0a950,
71
+ 0x0b557, // 1940-1949
72
+ 0x06ca0,
73
+ 0x0b550,
74
+ 0x15355,
75
+ 0x04da0,
76
+ 0x0a5b0,
77
+ 0x14573,
78
+ 0x052b0,
79
+ 0x0a9a8,
80
+ 0x0e950,
81
+ 0x06aa0, // 1950-1959
82
+ 0x0aea6,
83
+ 0x0ab50,
84
+ 0x04b60,
85
+ 0x0aae4,
86
+ 0x0a570,
87
+ 0x05260,
88
+ 0x0f263,
89
+ 0x0d950,
90
+ 0x05b57,
91
+ 0x056a0, // 1960-1969
92
+ 0x096d0,
93
+ 0x04dd5,
94
+ 0x04ad0,
95
+ 0x0a4d0,
96
+ 0x0d4d4,
97
+ 0x0d250,
98
+ 0x0d558,
99
+ 0x0b540,
100
+ 0x0b6a0,
101
+ 0x195a6, // 1970-1979
102
+ 0x095b0,
103
+ 0x049b0,
104
+ 0x0a974,
105
+ 0x0a4b0,
106
+ 0x0b27a,
107
+ 0x06a50,
108
+ 0x06d40,
109
+ 0x0af46,
110
+ 0x0ab60,
111
+ 0x09570, // 1980-1989
112
+ 0x04af5,
113
+ 0x04970,
114
+ 0x064b0,
115
+ 0x074a3,
116
+ 0x0ea50,
117
+ 0x06b58,
118
+ 0x05ac0,
119
+ 0x0ab60,
120
+ 0x096d5,
121
+ 0x092e0, // 1990-1999
122
+ 0x0c960,
123
+ 0x0d954,
124
+ 0x0d4a0,
125
+ 0x0da50,
126
+ 0x07552,
127
+ 0x056a0,
128
+ 0x0abb7,
129
+ 0x025d0,
130
+ 0x092d0,
131
+ 0x0cab5, // 2000-2009
132
+ 0x0a950,
133
+ 0x0b4a0,
134
+ 0x0baa4,
135
+ 0x0ad50,
136
+ 0x055d9,
137
+ 0x04ba0,
138
+ 0x0a5b0,
139
+ 0x15176,
140
+ 0x052b0,
141
+ 0x0a930, // 2010-2019
142
+ 0x07954,
143
+ 0x06aa0,
144
+ 0x0ad50,
145
+ 0x05b52,
146
+ 0x04b60,
147
+ 0x0a6e6,
148
+ 0x0a4e0,
149
+ 0x0d260,
150
+ 0x0ea65,
151
+ 0x0d530, // 2020-2029
152
+ 0x05aa0,
153
+ 0x076a3,
154
+ 0x096d0,
155
+ 0x04afb,
156
+ 0x04ad0,
157
+ 0x0a4d0,
158
+ 0x1d0b6,
159
+ 0x0d250,
160
+ 0x0d520,
161
+ 0x0dd45, // 2030-2039
162
+ 0x0b5a0,
163
+ 0x056d0,
164
+ 0x055b2,
165
+ 0x049b0,
166
+ 0x0a577,
167
+ 0x0a4b0,
168
+ 0x0aa50,
169
+ 0x1b255,
170
+ 0x06d20,
171
+ 0x0ada0, // 2040-2049
172
+ /** Add By JJonline@JJonline.Cn**/
173
+ 0x14b63,
174
+ 0x09370,
175
+ 0x049f8,
176
+ 0x04970,
177
+ 0x064b0,
178
+ 0x168a6,
179
+ 0x0ea50,
180
+ 0x06b20,
181
+ 0x1a6c4,
182
+ 0x0aae0, // 2050-2059
183
+ 0x0a2e0,
184
+ 0x0d2e3,
185
+ 0x0c960,
186
+ 0x0d557,
187
+ 0x0d4a0,
188
+ 0x0da50,
189
+ 0x05d55,
190
+ 0x056a0,
191
+ 0x0a6d0,
192
+ 0x055d4, // 2060-2069
193
+ 0x052d0,
194
+ 0x0a9b8,
195
+ 0x0a950,
196
+ 0x0b4a0,
197
+ 0x0b6a6,
198
+ 0x0ad50,
199
+ 0x055a0,
200
+ 0x0aba4,
201
+ 0x0a5b0,
202
+ 0x052b0, // 2070-2079
203
+ 0x0b273,
204
+ 0x06930,
205
+ 0x07337,
206
+ 0x06aa0,
207
+ 0x0ad50,
208
+ 0x14b55,
209
+ 0x04b60,
210
+ 0x0a570,
211
+ 0x054e4,
212
+ 0x0d160, // 2080-2089
213
+ 0x0e968,
214
+ 0x0d520,
215
+ 0x0daa0,
216
+ 0x16aa6,
217
+ 0x056d0,
218
+ 0x04ae0,
219
+ 0x0a9d4,
220
+ 0x0a2d0,
221
+ 0x0d150,
222
+ 0x0f252, // 2090-2099
223
+ 0x0d520,
224
+ ], // 2100
225
+
226
+ /**
227
+ * 公历每个月份的天数普通表
228
+ * @Array Of Property
229
+ * @return Number
230
+ */
231
+ solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
232
+
233
+ /**
234
+ * 天干地支之天干速查表
235
+ * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
236
+ * @return Cn string
237
+ */
238
+ Gan: [
239
+ "\u7532",
240
+ "\u4e59",
241
+ "\u4e19",
242
+ "\u4e01",
243
+ "\u620a",
244
+ "\u5df1",
245
+ "\u5e9a",
246
+ "\u8f9b",
247
+ "\u58ec",
248
+ "\u7678",
249
+ ],
250
+
251
+ /**
252
+ * 天干地支之地支速查表
253
+ * @Array Of Property
254
+ * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
255
+ * @return Cn string
256
+ */
257
+ Zhi: [
258
+ "\u5b50",
259
+ "\u4e11",
260
+ "\u5bc5",
261
+ "\u536f",
262
+ "\u8fb0",
263
+ "\u5df3",
264
+ "\u5348",
265
+ "\u672a",
266
+ "\u7533",
267
+ "\u9149",
268
+ "\u620c",
269
+ "\u4ea5",
270
+ ],
271
+
272
+ /**
273
+ * 天干地支之地支速查表<=>生肖
274
+ * @Array Of Property
275
+ * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
276
+ * @return Cn string
277
+ */
278
+ Animals: [
279
+ "\u9f20",
280
+ "\u725b",
281
+ "\u864e",
282
+ "\u5154",
283
+ "\u9f99",
284
+ "\u86c7",
285
+ "\u9a6c",
286
+ "\u7f8a",
287
+ "\u7334",
288
+ "\u9e21",
289
+ "\u72d7",
290
+ "\u732a",
291
+ ],
292
+
293
+ /**
294
+ * 24节气速查表
295
+ * @Array Of Property
296
+ * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
297
+ * @return Cn string
298
+ */
299
+ solarTerm: [
300
+ "\u5c0f\u5bd2",
301
+ "\u5927\u5bd2",
302
+ "\u7acb\u6625",
303
+ "\u96e8\u6c34",
304
+ "\u60ca\u86f0",
305
+ "\u6625\u5206",
306
+ "\u6e05\u660e",
307
+ "\u8c37\u96e8",
308
+ "\u7acb\u590f",
309
+ "\u5c0f\u6ee1",
310
+ "\u8292\u79cd",
311
+ "\u590f\u81f3",
312
+ "\u5c0f\u6691",
313
+ "\u5927\u6691",
314
+ "\u7acb\u79cb",
315
+ "\u5904\u6691",
316
+ "\u767d\u9732",
317
+ "\u79cb\u5206",
318
+ "\u5bd2\u9732",
319
+ "\u971c\u964d",
320
+ "\u7acb\u51ac",
321
+ "\u5c0f\u96ea",
322
+ "\u5927\u96ea",
323
+ "\u51ac\u81f3",
324
+ ],
325
+
326
+ /**
327
+ * 1900-2100各年的24节气日期速查表
328
+ * @Array Of Property
329
+ * @return 0x string For splice
330
+ */
331
+ sTermInfo: [
332
+ "9778397bd097c36b0b6fc9274c91aa",
333
+ "97b6b97bd19801ec9210c965cc920e",
334
+ "97bcf97c3598082c95f8c965cc920f",
335
+ "97bd0b06bdb0722c965ce1cfcc920f",
336
+ "b027097bd097c36b0b6fc9274c91aa",
337
+ "97b6b97bd19801ec9210c965cc920e",
338
+ "97bcf97c359801ec95f8c965cc920f",
339
+ "97bd0b06bdb0722c965ce1cfcc920f",
340
+ "b027097bd097c36b0b6fc9274c91aa",
341
+ "97b6b97bd19801ec9210c965cc920e",
342
+ "97bcf97c359801ec95f8c965cc920f",
343
+ "97bd0b06bdb0722c965ce1cfcc920f",
344
+ "b027097bd097c36b0b6fc9274c91aa",
345
+ "9778397bd19801ec9210c965cc920e",
346
+ "97b6b97bd19801ec95f8c965cc920f",
347
+ "97bd09801d98082c95f8e1cfcc920f",
348
+ "97bd097bd097c36b0b6fc9210c8dc2",
349
+ "9778397bd197c36c9210c9274c91aa",
350
+ "97b6b97bd19801ec95f8c965cc920e",
351
+ "97bd09801d98082c95f8e1cfcc920f",
352
+ "97bd097bd097c36b0b6fc9210c8dc2",
353
+ "9778397bd097c36c9210c9274c91aa",
354
+ "97b6b97bd19801ec95f8c965cc920e",
355
+ "97bcf97c3598082c95f8e1cfcc920f",
356
+ "97bd097bd097c36b0b6fc9210c8dc2",
357
+ "9778397bd097c36c9210c9274c91aa",
358
+ "97b6b97bd19801ec9210c965cc920e",
359
+ "97bcf97c3598082c95f8c965cc920f",
360
+ "97bd097bd097c35b0b6fc920fb0722",
361
+ "9778397bd097c36b0b6fc9274c91aa",
362
+ "97b6b97bd19801ec9210c965cc920e",
363
+ "97bcf97c3598082c95f8c965cc920f",
364
+ "97bd097bd097c35b0b6fc920fb0722",
365
+ "9778397bd097c36b0b6fc9274c91aa",
366
+ "97b6b97bd19801ec9210c965cc920e",
367
+ "97bcf97c359801ec95f8c965cc920f",
368
+ "97bd097bd097c35b0b6fc920fb0722",
369
+ "9778397bd097c36b0b6fc9274c91aa",
370
+ "97b6b97bd19801ec9210c965cc920e",
371
+ "97bcf97c359801ec95f8c965cc920f",
372
+ "97bd097bd097c35b0b6fc920fb0722",
373
+ "9778397bd097c36b0b6fc9274c91aa",
374
+ "97b6b97bd19801ec9210c965cc920e",
375
+ "97bcf97c359801ec95f8c965cc920f",
376
+ "97bd097bd07f595b0b6fc920fb0722",
377
+ "9778397bd097c36b0b6fc9210c8dc2",
378
+ "9778397bd19801ec9210c9274c920e",
379
+ "97b6b97bd19801ec95f8c965cc920f",
380
+ "97bd07f5307f595b0b0bc920fb0722",
381
+ "7f0e397bd097c36b0b6fc9210c8dc2",
382
+ "9778397bd097c36c9210c9274c920e",
383
+ "97b6b97bd19801ec95f8c965cc920f",
384
+ "97bd07f5307f595b0b0bc920fb0722",
385
+ "7f0e397bd097c36b0b6fc9210c8dc2",
386
+ "9778397bd097c36c9210c9274c91aa",
387
+ "97b6b97bd19801ec9210c965cc920e",
388
+ "97bd07f1487f595b0b0bc920fb0722",
389
+ "7f0e397bd097c36b0b6fc9210c8dc2",
390
+ "9778397bd097c36b0b6fc9274c91aa",
391
+ "97b6b97bd19801ec9210c965cc920e",
392
+ "97bcf7f1487f595b0b0bb0b6fb0722",
393
+ "7f0e397bd097c35b0b6fc920fb0722",
394
+ "9778397bd097c36b0b6fc9274c91aa",
395
+ "97b6b97bd19801ec9210c965cc920e",
396
+ "97bcf7f1487f595b0b0bb0b6fb0722",
397
+ "7f0e397bd097c35b0b6fc920fb0722",
398
+ "9778397bd097c36b0b6fc9274c91aa",
399
+ "97b6b97bd19801ec9210c965cc920e",
400
+ "97bcf7f1487f531b0b0bb0b6fb0722",
401
+ "7f0e397bd097c35b0b6fc920fb0722",
402
+ "9778397bd097c36b0b6fc9274c91aa",
403
+ "97b6b97bd19801ec9210c965cc920e",
404
+ "97bcf7f1487f531b0b0bb0b6fb0722",
405
+ "7f0e397bd07f595b0b6fc920fb0722",
406
+ "9778397bd097c36b0b6fc9274c91aa",
407
+ "97b6b97bd19801ec9210c9274c920e",
408
+ "97bcf7f0e47f531b0b0bb0b6fb0722",
409
+ "7f0e397bd07f595b0b0bc920fb0722",
410
+ "9778397bd097c36b0b6fc9210c91aa",
411
+ "97b6b97bd197c36c9210c9274c920e",
412
+ "97bcf7f0e47f531b0b0bb0b6fb0722",
413
+ "7f0e397bd07f595b0b0bc920fb0722",
414
+ "9778397bd097c36b0b6fc9210c8dc2",
415
+ "9778397bd097c36c9210c9274c920e",
416
+ "97b6b7f0e47f531b0723b0b6fb0722",
417
+ "7f0e37f5307f595b0b0bc920fb0722",
418
+ "7f0e397bd097c36b0b6fc9210c8dc2",
419
+ "9778397bd097c36b0b70c9274c91aa",
420
+ "97b6b7f0e47f531b0723b0b6fb0721",
421
+ "7f0e37f1487f595b0b0bb0b6fb0722",
422
+ "7f0e397bd097c35b0b6fc9210c8dc2",
423
+ "9778397bd097c36b0b6fc9274c91aa",
424
+ "97b6b7f0e47f531b0723b0b6fb0721",
425
+ "7f0e27f1487f595b0b0bb0b6fb0722",
426
+ "7f0e397bd097c35b0b6fc920fb0722",
427
+ "9778397bd097c36b0b6fc9274c91aa",
428
+ "97b6b7f0e47f531b0723b0b6fb0721",
429
+ "7f0e27f1487f531b0b0bb0b6fb0722",
430
+ "7f0e397bd097c35b0b6fc920fb0722",
431
+ "9778397bd097c36b0b6fc9274c91aa",
432
+ "97b6b7f0e47f531b0723b0b6fb0721",
433
+ "7f0e27f1487f531b0b0bb0b6fb0722",
434
+ "7f0e397bd097c35b0b6fc920fb0722",
435
+ "9778397bd097c36b0b6fc9274c91aa",
436
+ "97b6b7f0e47f531b0723b0b6fb0721",
437
+ "7f0e27f1487f531b0b0bb0b6fb0722",
438
+ "7f0e397bd07f595b0b0bc920fb0722",
439
+ "9778397bd097c36b0b6fc9274c91aa",
440
+ "97b6b7f0e47f531b0723b0787b0721",
441
+ "7f0e27f0e47f531b0b0bb0b6fb0722",
442
+ "7f0e397bd07f595b0b0bc920fb0722",
443
+ "9778397bd097c36b0b6fc9210c91aa",
444
+ "97b6b7f0e47f149b0723b0787b0721",
445
+ "7f0e27f0e47f531b0723b0b6fb0722",
446
+ "7f0e397bd07f595b0b0bc920fb0722",
447
+ "9778397bd097c36b0b6fc9210c8dc2",
448
+ "977837f0e37f149b0723b0787b0721",
449
+ "7f07e7f0e47f531b0723b0b6fb0722",
450
+ "7f0e37f5307f595b0b0bc920fb0722",
451
+ "7f0e397bd097c35b0b6fc9210c8dc2",
452
+ "977837f0e37f14998082b0787b0721",
453
+ "7f07e7f0e47f531b0723b0b6fb0721",
454
+ "7f0e37f1487f595b0b0bb0b6fb0722",
455
+ "7f0e397bd097c35b0b6fc9210c8dc2",
456
+ "977837f0e37f14998082b0787b06bd",
457
+ "7f07e7f0e47f531b0723b0b6fb0721",
458
+ "7f0e27f1487f531b0b0bb0b6fb0722",
459
+ "7f0e397bd097c35b0b6fc920fb0722",
460
+ "977837f0e37f14998082b0787b06bd",
461
+ "7f07e7f0e47f531b0723b0b6fb0721",
462
+ "7f0e27f1487f531b0b0bb0b6fb0722",
463
+ "7f0e397bd097c35b0b6fc920fb0722",
464
+ "977837f0e37f14998082b0787b06bd",
465
+ "7f07e7f0e47f531b0723b0b6fb0721",
466
+ "7f0e27f1487f531b0b0bb0b6fb0722",
467
+ "7f0e397bd07f595b0b0bc920fb0722",
468
+ "977837f0e37f14998082b0787b06bd",
469
+ "7f07e7f0e47f531b0723b0b6fb0721",
470
+ "7f0e27f1487f531b0b0bb0b6fb0722",
471
+ "7f0e397bd07f595b0b0bc920fb0722",
472
+ "977837f0e37f14998082b0787b06bd",
473
+ "7f07e7f0e47f149b0723b0787b0721",
474
+ "7f0e27f0e47f531b0b0bb0b6fb0722",
475
+ "7f0e397bd07f595b0b0bc920fb0722",
476
+ "977837f0e37f14998082b0723b06bd",
477
+ "7f07e7f0e37f149b0723b0787b0721",
478
+ "7f0e27f0e47f531b0723b0b6fb0722",
479
+ "7f0e397bd07f595b0b0bc920fb0722",
480
+ "977837f0e37f14898082b0723b02d5",
481
+ "7ec967f0e37f14998082b0787b0721",
482
+ "7f07e7f0e47f531b0723b0b6fb0722",
483
+ "7f0e37f1487f595b0b0bb0b6fb0722",
484
+ "7f0e37f0e37f14898082b0723b02d5",
485
+ "7ec967f0e37f14998082b0787b0721",
486
+ "7f07e7f0e47f531b0723b0b6fb0722",
487
+ "7f0e37f1487f531b0b0bb0b6fb0722",
488
+ "7f0e37f0e37f14898082b0723b02d5",
489
+ "7ec967f0e37f14998082b0787b06bd",
490
+ "7f07e7f0e47f531b0723b0b6fb0721",
491
+ "7f0e37f1487f531b0b0bb0b6fb0722",
492
+ "7f0e37f0e37f14898082b072297c35",
493
+ "7ec967f0e37f14998082b0787b06bd",
494
+ "7f07e7f0e47f531b0723b0b6fb0721",
495
+ "7f0e27f1487f531b0b0bb0b6fb0722",
496
+ "7f0e37f0e37f14898082b072297c35",
497
+ "7ec967f0e37f14998082b0787b06bd",
498
+ "7f07e7f0e47f531b0723b0b6fb0721",
499
+ "7f0e27f1487f531b0b0bb0b6fb0722",
500
+ "7f0e37f0e366aa89801eb072297c35",
501
+ "7ec967f0e37f14998082b0787b06bd",
502
+ "7f07e7f0e47f149b0723b0787b0721",
503
+ "7f0e27f1487f531b0b0bb0b6fb0722",
504
+ "7f0e37f0e366aa89801eb072297c35",
505
+ "7ec967f0e37f14998082b0723b06bd",
506
+ "7f07e7f0e47f149b0723b0787b0721",
507
+ "7f0e27f0e47f531b0723b0b6fb0722",
508
+ "7f0e37f0e366aa89801eb072297c35",
509
+ "7ec967f0e37f14998082b0723b06bd",
510
+ "7f07e7f0e37f14998083b0787b0721",
511
+ "7f0e27f0e47f531b0723b0b6fb0722",
512
+ "7f0e37f0e366aa89801eb072297c35",
513
+ "7ec967f0e37f14898082b0723b02d5",
514
+ "7f07e7f0e37f14998082b0787b0721",
515
+ "7f07e7f0e47f531b0723b0b6fb0722",
516
+ "7f0e36665b66aa89801e9808297c35",
517
+ "665f67f0e37f14898082b0723b02d5",
518
+ "7ec967f0e37f14998082b0787b0721",
519
+ "7f07e7f0e47f531b0723b0b6fb0722",
520
+ "7f0e36665b66a449801e9808297c35",
521
+ "665f67f0e37f14898082b0723b02d5",
522
+ "7ec967f0e37f14998082b0787b06bd",
523
+ "7f07e7f0e47f531b0723b0b6fb0721",
524
+ "7f0e36665b66a449801e9808297c35",
525
+ "665f67f0e37f14898082b072297c35",
526
+ "7ec967f0e37f14998082b0787b06bd",
527
+ "7f07e7f0e47f531b0723b0b6fb0721",
528
+ "7f0e26665b66a449801e9808297c35",
529
+ "665f67f0e37f1489801eb072297c35",
530
+ "7ec967f0e37f14998082b0787b06bd",
531
+ "7f07e7f0e47f531b0723b0b6fb0721",
532
+ "7f0e27f1487f531b0b0bb0b6fb0722",
533
+ ],
534
+
535
+ /**
536
+ * 数字转中文速查表
537
+ * @Array Of Property
538
+ * @trans ['日','一','二','三','四','五','六','七','八','九','十']
539
+ * @return Cn string
540
+ */
541
+ nStr1: [
542
+ "\u65e5",
543
+ "\u4e00",
544
+ "\u4e8c",
545
+ "\u4e09",
546
+ "\u56db",
547
+ "\u4e94",
548
+ "\u516d",
549
+ "\u4e03",
550
+ "\u516b",
551
+ "\u4e5d",
552
+ "\u5341",
553
+ ],
554
+
555
+ /**
556
+ * 日期转农历称呼速查表
557
+ * @Array Of Property
558
+ * @trans ['初','十','廿','卅']
559
+ * @return Cn string
560
+ */
561
+ nStr2: ["\u521d", "\u5341", "\u5eff", "\u5345"],
562
+
563
+ /**
564
+ * 月份转农历称呼速查表
565
+ * @Array Of Property
566
+ * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
567
+ * @return Cn string
568
+ */
569
+ nStr3: [
570
+ "\u6b63",
571
+ "\u4e8c",
572
+ "\u4e09",
573
+ "\u56db",
574
+ "\u4e94",
575
+ "\u516d",
576
+ "\u4e03",
577
+ "\u516b",
578
+ "\u4e5d",
579
+ "\u5341",
580
+ "\u51ac",
581
+ "\u814a",
582
+ ],
583
+
584
+ /**
585
+ * 返回农历y年一整年的总天数
586
+ * @param lunar Year
587
+ * @return Number
588
+ * @eg:var count = calendar.lYearDays(1987) ;//count=387
589
+ */
590
+ lYearDays: function (y) {
591
+ var i;
592
+ var sum = 348;
593
+ for (i = 0x8000; i > 0x8; i >>= 1) {
594
+ sum += this.lunarInfo[y - 1900] & i ? 1 : 0;
595
+ }
596
+ return sum + this.leapDays(y);
597
+ },
598
+
599
+ /**
600
+ * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
601
+ * @param lunar Year
602
+ * @return Number (0-12)
603
+ * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
604
+ */
605
+ leapMonth: function (y) {
606
+ // 闰字编码 \u95f0
607
+ return this.lunarInfo[y - 1900] & 0xf;
608
+ },
609
+
610
+ /**
611
+ * 返回农历y年闰月的天数 若该年没有闰月则返回0
612
+ * @param lunar Year
613
+ * @return Number (0、29、30)
614
+ * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
615
+ */
616
+ leapDays: function (y) {
617
+ if (this.leapMonth(y)) {
618
+ return this.lunarInfo[y - 1900] & 0x10000 ? 30 : 29;
619
+ }
620
+ return 0;
621
+ },
622
+
623
+ /**
624
+ * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
625
+ * @param lunar Year
626
+ * @return Number (-1、29、30)
627
+ * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
628
+ */
629
+ monthDays: function (y, m) {
630
+ if (m > 12 || m < 1) {
631
+ return -1;
632
+ } // 月份参数从1至12,参数错误返回-1
633
+ return this.lunarInfo[y - 1900] & (0x10000 >> m) ? 30 : 29;
634
+ },
635
+
636
+ /**
637
+ * 返回公历(!)y年m月的天数
638
+ * @param solar Year
639
+ * @return Number (-1、28、29、30、31)
640
+ * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
641
+ */
642
+ solarDays: function (y, m) {
643
+ if (m > 12 || m < 1) {
644
+ return -1;
645
+ } // 若参数错误 返回-1
646
+ var ms = m - 1;
647
+ if (ms == 1) {
648
+ // 2月份的闰平规律测算后确认返回28或29
649
+ return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0 ? 29 : 28;
650
+ } else {
651
+ return this.solarMonth[ms];
652
+ }
653
+ },
654
+
655
+ /**
656
+ * 农历年份转换为干支纪年
657
+ * @param lYear 农历年的年份数
658
+ * @return Cn string
659
+ */
660
+ toGanZhiYear: function (lYear) {
661
+ var ganKey = (lYear - 3) % 10;
662
+ var zhiKey = (lYear - 3) % 12;
663
+ if (ganKey == 0) ganKey = 10; // 如果余数为0则为最后一个天干
664
+ if (zhiKey == 0) zhiKey = 12; // 如果余数为0则为最后一个地支
665
+ return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1];
666
+ },
667
+
668
+ /**
669
+ * 公历月、日判断所属星座
670
+ * @param cMonth [description]
671
+ * @param cDay [description]
672
+ * @return Cn string
673
+ */
674
+ toAstro: function (cMonth, cDay) {
675
+ var s =
676
+ "\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";
677
+ var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22];
678
+ return (
679
+ s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "\u5ea7"
680
+ ); // 座
681
+ },
682
+
683
+ /**
684
+ * 传入offset偏移量返回干支
685
+ * @param offset 相对甲子的偏移量
686
+ * @return Cn string
687
+ */
688
+ toGanZhi: function (offset) {
689
+ return this.Gan[offset % 10] + this.Zhi[offset % 12];
690
+ },
691
+
692
+ /**
693
+ * 传入公历(!)y年获得该年第n个节气的公历日期
694
+ * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
695
+ * @return day Number
696
+ * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
697
+ */
698
+ getTerm: function (y, n) {
699
+ if (y < 1900 || y > 2100) {
700
+ return -1;
701
+ }
702
+ if (n < 1 || n > 24) {
703
+ return -1;
704
+ }
705
+ var _table = this.sTermInfo[y - 1900];
706
+ var _info = [
707
+ parseInt("0x" + _table.substr(0, 5)).toString(),
708
+ parseInt("0x" + _table.substr(5, 5)).toString(),
709
+ parseInt("0x" + _table.substr(10, 5)).toString(),
710
+ parseInt("0x" + _table.substr(15, 5)).toString(),
711
+ parseInt("0x" + _table.substr(20, 5)).toString(),
712
+ parseInt("0x" + _table.substr(25, 5)).toString(),
713
+ ];
714
+ var _calday = [
715
+ _info[0].substr(0, 1),
716
+ _info[0].substr(1, 2),
717
+ _info[0].substr(3, 1),
718
+ _info[0].substr(4, 2),
719
+
720
+ _info[1].substr(0, 1),
721
+ _info[1].substr(1, 2),
722
+ _info[1].substr(3, 1),
723
+ _info[1].substr(4, 2),
724
+
725
+ _info[2].substr(0, 1),
726
+ _info[2].substr(1, 2),
727
+ _info[2].substr(3, 1),
728
+ _info[2].substr(4, 2),
729
+
730
+ _info[3].substr(0, 1),
731
+ _info[3].substr(1, 2),
732
+ _info[3].substr(3, 1),
733
+ _info[3].substr(4, 2),
734
+
735
+ _info[4].substr(0, 1),
736
+ _info[4].substr(1, 2),
737
+ _info[4].substr(3, 1),
738
+ _info[4].substr(4, 2),
739
+
740
+ _info[5].substr(0, 1),
741
+ _info[5].substr(1, 2),
742
+ _info[5].substr(3, 1),
743
+ _info[5].substr(4, 2),
744
+ ];
745
+ return parseInt(_calday[n - 1]);
746
+ },
747
+
748
+ /**
749
+ * 传入农历数字月份返回汉语通俗表示法
750
+ * @param lunar month
751
+ * @return Cn string
752
+ * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
753
+ */
754
+ toChinaMonth: function (m) {
755
+ // 月 => \u6708
756
+ if (m > 12 || m < 1) {
757
+ return -1;
758
+ } // 若参数错误 返回-1
759
+ var s = this.nStr3[m - 1];
760
+ s += "\u6708"; // 加上月字
761
+ return s;
762
+ },
763
+
764
+ /**
765
+ * 传入农历日期数字返回汉字表示法
766
+ * @param lunar day
767
+ * @return Cn string
768
+ * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
769
+ */
770
+ toChinaDay: function (d) {
771
+ // 日 => \u65e5
772
+ var s;
773
+ switch (d) {
774
+ case 10:
775
+ s = "\u521d\u5341";
776
+ break;
777
+ case 20:
778
+ s = "\u4e8c\u5341";
779
+ break;
780
+ break;
781
+ case 30:
782
+ s = "\u4e09\u5341";
783
+ break;
784
+ break;
785
+ default:
786
+ s = this.nStr2[Math.floor(d / 10)];
787
+ s += this.nStr1[d % 10];
788
+ }
789
+ return s;
790
+ },
791
+
792
+ /**
793
+ * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
794
+ * @param y year
795
+ * @return Cn string
796
+ * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
797
+ */
798
+ getAnimal: function (y) {
799
+ return this.Animals[(y - 4) % 12];
800
+ },
801
+
802
+ /**
803
+ * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
804
+ * @param y solar year
805
+ * @param m solar month
806
+ * @param d solar day
807
+ * @return JSON object
808
+ * @eg:console.log(calendar.solar2lunar(1987,11,01));
809
+ */
810
+ solar2lunar: function (y, m, d) {
811
+ // 参数区间1900.1.31~2100.12.31
812
+ // 年份限定、上限
813
+ if (y < 1900 || y > 2100) {
814
+ return -1; // undefined转换为数字变为NaN
815
+ }
816
+ // 公历传参最下限
817
+ if (y == 1900 && m == 1 && d < 31) {
818
+ return -1;
819
+ }
820
+ // 未传参 获得当天
821
+ if (!y) {
822
+ var objDate = new Date();
823
+ } else {
824
+ var objDate = new Date(y, parseInt(m) - 1, d);
825
+ }
826
+ var i;
827
+ var leap = 0;
828
+ var temp = 0;
829
+ // 修正ymd参数
830
+ var y = objDate.getFullYear();
831
+ var m = objDate.getMonth() + 1;
832
+ var d = objDate.getDate();
833
+ var offset =
834
+ (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) -
835
+ Date.UTC(1900, 0, 31)) /
836
+ 86400000;
837
+ for (i = 1900; i < 2101 && offset > 0; i++) {
838
+ temp = this.lYearDays(i);
839
+ offset -= temp;
840
+ }
841
+ if (offset < 0) {
842
+ offset += temp;
843
+ i--;
844
+ }
845
+
846
+ // 是否今天
847
+ var isTodayObj = new Date();
848
+ var isToday = false;
849
+ if (
850
+ isTodayObj.getFullYear() == y &&
851
+ isTodayObj.getMonth() + 1 == m &&
852
+ isTodayObj.getDate() == d
853
+ ) {
854
+ isToday = true;
855
+ }
856
+ // 星期几
857
+ var nWeek = objDate.getDay();
858
+ var cWeek = this.nStr1[nWeek];
859
+ // 数字表示周几顺应天朝周一开始的惯例
860
+ if (nWeek == 0) {
861
+ nWeek = 7;
862
+ }
863
+ // 农历年
864
+ var year = i;
865
+ var leap = this.leapMonth(i); // 闰哪个月
866
+ var isLeap = false;
867
+
868
+ // 效验闰月
869
+ for (i = 1; i < 13 && offset > 0; i++) {
870
+ // 闰月
871
+ if (leap > 0 && i == leap + 1 && isLeap == false) {
872
+ --i;
873
+ isLeap = true;
874
+ temp = this.leapDays(year); // 计算农历闰月天数
875
+ } else {
876
+ temp = this.monthDays(year, i); // 计算农历普通月天数
877
+ }
878
+ // 解除闰月
879
+ if (isLeap == true && i == leap + 1) {
880
+ isLeap = false;
881
+ }
882
+ offset -= temp;
883
+ }
884
+ // 闰月导致数组下标重叠取反
885
+ if (offset == 0 && leap > 0 && i == leap + 1) {
886
+ if (isLeap) {
887
+ isLeap = false;
888
+ } else {
889
+ isLeap = true;
890
+ --i;
891
+ }
892
+ }
893
+ if (offset < 0) {
894
+ offset += temp;
895
+ --i;
896
+ }
897
+ // 农历月
898
+ var month = i;
899
+ // 农历日
900
+ var day = offset + 1;
901
+ // 天干地支处理
902
+ var sm = m - 1;
903
+ var gzY = this.toGanZhiYear(year);
904
+
905
+ // 当月的两个节气
906
+ // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
907
+ var firstNode = this.getTerm(y, m * 2 - 1); // 返回当月「节」为几日开始
908
+ var secondNode = this.getTerm(y, m * 2); // 返回当月「节」为几日开始
909
+
910
+ // 依据12节气修正干支月
911
+ var gzM = this.toGanZhi((y - 1900) * 12 + m + 11);
912
+ if (d >= firstNode) {
913
+ gzM = this.toGanZhi((y - 1900) * 12 + m + 12);
914
+ }
915
+
916
+ // 传入的日期的节气与否
917
+ var isTerm = false;
918
+ var Term = null;
919
+ if (firstNode == d) {
920
+ isTerm = true;
921
+ Term = this.solarTerm[m * 2 - 2];
922
+ }
923
+ if (secondNode == d) {
924
+ isTerm = true;
925
+ Term = this.solarTerm[m * 2 - 1];
926
+ }
927
+ // 日柱 当月一日与 1900/1/1 相差天数
928
+ var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10;
929
+ var gzD = this.toGanZhi(dayCyclical + d - 1);
930
+ // 该日期所属的星座
931
+ var astro = this.toAstro(m, d);
932
+
933
+ return {
934
+ lYear: year,
935
+ lMonth: month,
936
+ lDay: day,
937
+ Animal: this.getAnimal(year),
938
+ IMonthCn: (isLeap ? "\u95f0" : "") + this.toChinaMonth(month),
939
+ IDayCn: this.toChinaDay(day),
940
+ cYear: y,
941
+ cMonth: m,
942
+ cDay: d,
943
+ gzYear: gzY,
944
+ gzMonth: gzM,
945
+ gzDay: gzD,
946
+ isToday: isToday,
947
+ isLeap: isLeap,
948
+ nWeek: nWeek,
949
+ ncWeek: "\u661f\u671f" + cWeek,
950
+ isTerm: isTerm,
951
+ Term: Term,
952
+ astro: astro,
953
+ };
954
+ },
955
+
956
+ /**
957
+ * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
958
+ * @param y lunar year
959
+ * @param m lunar month
960
+ * @param d lunar day
961
+ * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
962
+ * @return JSON object
963
+ * @eg:console.log(calendar.lunar2solar(1987,9,10));
964
+ */
965
+ lunar2solar: function (y, m, d, isLeapMonth) {
966
+ // 参数区间1900.1.31~2100.12.1
967
+ var isLeapMonth = !!isLeapMonth;
968
+ var leapOffset = 0;
969
+ var leapMonth = this.leapMonth(y);
970
+ var leapDay = this.leapDays(y);
971
+ if (isLeapMonth && leapMonth != m) {
972
+ return -1;
973
+ } // 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
974
+ if ((y == 2100 && m == 12 && d > 1) || (y == 1900 && m == 1 && d < 31)) {
975
+ return -1;
976
+ } // 超出了最大极限值
977
+ var day = this.monthDays(y, m);
978
+ var _day = day;
979
+ // bugFix 2016-9-25
980
+ // if month is leap, _day use leapDays method
981
+ if (isLeapMonth) {
982
+ _day = this.leapDays(y, m);
983
+ }
984
+ if (y < 1900 || y > 2100 || d > _day) {
985
+ return -1;
986
+ } // 参数合法性效验
987
+
988
+ // 计算农历的时间差
989
+ var offset = 0;
990
+ for (var i = 1900; i < y; i++) {
991
+ offset += this.lYearDays(i);
992
+ }
993
+ var leap = 0;
994
+ var isAdd = false;
995
+ for (var i = 1; i < m; i++) {
996
+ leap = this.leapMonth(y);
997
+ if (!isAdd) {
998
+ // 处理闰月
999
+ if (leap <= i && leap > 0) {
1000
+ offset += this.leapDays(y);
1001
+ isAdd = true;
1002
+ }
1003
+ }
1004
+ offset += this.monthDays(y, i);
1005
+ }
1006
+ // 转换闰月农历 需补充该年闰月的前一个月的时差
1007
+ if (isLeapMonth) {
1008
+ offset += day;
1009
+ }
1010
+ // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
1011
+ var stmap = Date.UTC(1900, 1, 30, 0, 0, 0);
1012
+ var calObj = new Date((offset + d - 31) * 86400000 + stmap);
1013
+ var cY = calObj.getUTCFullYear();
1014
+ var cM = calObj.getUTCMonth() + 1;
1015
+ var cD = calObj.getUTCDate();
1016
+
1017
+ return this.solar2lunar(cY, cM, cD);
1018
+ },
1019
+ };
1020
+
1021
+ export default Calendar;