We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lunar/lib/chinese-lunar.js
Line 540 in 34940a8
Line 244 in 34940a8
Line 248 in 34940a8
例子:
var a = new Date(2017, 7, 22) // 农历七月初一 var b = new Date('2017-9-1 16:20:20') // 农历七月十一 var c = new Date('2017-9-1') var span1 = b.getTime() - a.getTime() // 922820000 var diff1 = Math.ceil(span1/ 1000 / 60 / 60 /24) // 结果为11,算上后面再加上的一天,那么农历则为七月十二,错误 var span2 = c.getTime() - a.getTime() // 864000000 var diff2 = Math.ceil(span2/ 1000 / 60 / 60 /24) // 结果为10,算上后面再加上的一天,那么农历则为七月十一,正确
最后在 switch-case 也不需要 Math.ceil
switch-case
Math.ceil
The text was updated successfully, but these errors were encountered:
我用 moment.js 把时间设为 0 点 再传入计算农历
const lunar = chineseLunar.solarToLunar(moment().startOf('day').toDate(), 'MD');
Sorry, something went wrong.
No branches or pull requests
lunar/lib/chinese-lunar.js
Line 540 in 34940a8
lunar/lib/chinese-lunar.js
Line 244 in 34940a8
lunar/lib/chinese-lunar.js
Line 248 in 34940a8
例子:
最后在
switch-case
也不需要Math.ceil
The text was updated successfully, but these errors were encountered: