Giter Site home page Giter Site logo

lofanmi / chinese-calendar-golang Goto Github PK

View Code? Open in Web Editor NEW
144.0 6.0 34.0 287 KB

📅 公历 农历 干支历转换包 提供精确的日历转换

License: MIT License

Go 99.95% Makefile 0.01% Shell 0.05%
chinese calendar solar lunar ganzhi guoli nongli ganzhili

chinese-calendar-golang's Introduction

Hi boys 👋

Github visitor badge

I ❤ Open Open Source.

  • 🤔 I’m currently using GoLang PHP 😁
  • 📫 How to reach me. imlht.com

Lofanmi's github stats Top Langs

github contribution grid snake animation

chinese-calendar-golang's People

Contributors

lofanmi avatar sy-lht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chinese-calendar-golang's Issues

Implement the algorithm for the lunar calendar

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年我都发现好几个了,建议用寿星天文历

2033问题出来了

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

支持的年份太少了

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

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)
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.