I ❤ Open Open Source.
- 🤔 I’m currently using
GoLang
PHP
😁 - 📫 How to reach me. imlht.com
📅 公历 农历 干支历转换包 提供精确的日历转换
License: MIT License
I ❤ Open Open Source.
GoLang
PHP
😁what do you mean by that ?, can you elaborate, ?, does this mean that the gan zhi calculation will break when we input the year 2101?, also if I input from solar calender, the translation to lunar will be broken ?, is that what you refer to ?
can you give me further explanation in english , maybe I can contribute for the un done todo,
do you calculate the gan zhi with Lunar Calender ?, is so then the calculation of gan zhi will be not accurate if the lunar year is > 2101, even is it support until year 3000. is that the case ?
1997年10月26日 廿四
27日 就變成 廿六 了
1990年3月25日 和 26日 都是 廿九
还在继续维护吗?
阴历还是只支持到2024年吗?
这个时间快到了
正确代码:
limits := [...]int64{20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22}
constellations := []string{"水瓶", "双鱼", "白羊", "金牛", "双子", "巨蟹", "狮子", "处女", "天秤", "天蝎", "射手", "魔羯"}
nameIndex := c.Solar.GetMonth() - 1
fmt.Println("名称", nameIndex, constellations[nameIndex])
limit := limits[c.Solar.GetMonth()-1]
fmt.Println("边界", limit)
if c.Solar.GetDay() < limit {
nameIndex -= 1
}
if nameIndex < 0 {
nameIndex = int64(len(constellations) - 1)
}
fmt.Println(string(constellations[nameIndex]))
例如:一九九六年八月二十五,干支历是:丁丑日,计算的结果显示【丙子】,这是错误的。
其实网上流传的各种库都是相互抄的,农历有很多错误的,1996年我都发现好几个了,建议用寿星天文历
liangzi@xuan 5 04:42 >go run 一个阳历转农历的api接口.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x4c5f5e]
goroutine 1 [running]:
github.com/Lofanmi/chinese-calendar-golang/ganzhi.(*Ganzhi).Animal(...)
/home/xuan/go_work/pkg/mod/github.com/!lofanmi/[email protected]/ganzhi/ganzhi.go:78
github.com/Lofanmi/chinese-calendar-golang/calendar.(*Calendar).ToJSON(0xc00000c120, 0xb, 0x15, 0xc, 0x1, 0x0)
/home/xuan/go_work/pkg/mod/github.com/!lofanmi/[email protected]/calendar/calendar.go:86 +0xffe
main.main()
/home/xuan/nfs_share/golang/other/other/一个阳历转农历的api接口.go:18 +0xad
exit status 2
或者类似time.now生成今天的农历
和特定的年份的农历计算差值天数
给我一个方法可以吗?
这个评价很精确
如题
var solartermTimestamp = [...]int64{
// 1904
-2082349399, -2081077349, -2079801372, -2078519728, -2077229320, -2075929307,
-2074617687, -2073295088, -2071960898, -2070617473, -2069265548, -2067908921,
-2066549299, -2065191025, -2063836089, -2062488216, -2061148922, -2059820386,
-2058503062, -2057197251, -2055902092, -2054616234, -2053337663, -2052063944,
请问一下这个时间如何扩展?
Lunar Calendar error for 2024.
Please check the test code which produces invalid date 2024/05/11 instead of 2024/05/10.
func TestLunar(t *testing.T) {
tzName := "Asia/Shanghai"
cc := gocalendar.DefaultCalendar()
ld, err := cc.LunarToGregorian(2024, 5, 5, false)
if err != nil {
t.Errorf("Error converting from lunar to gregorian: %v", err)
return
}
tz, _ := time.LoadLocation(tzName)
d := time.Date(2024, time.June, 10, 0, 0, 0, 0, tz)
if d.Format("2006-01-02") != ld.In(tz).Format("2006-01-02") {
t.Errorf("Unmatched calendar for Tuen Ng Fesitival(端午节), expecting %v, got %v", d, ld)
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.