Skip to content
New issue

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

Is there any consideration to support converting the lunar calendar to the Gregorian calendar? #196

Closed
jioswu opened this issue Nov 6, 2023 · 3 comments
Labels
Under consideration Under consideration

Comments

@jioswu
Copy link

jioswu commented Nov 6, 2023

是否有考虑支持农历转公历呢
只有公历转农历,缺少农历转公历
而且现有的公历转农历后好像没法直接返回time对象

@Issues-translate-bot
Copy link
Collaborator

The issue body's language is not English, translate it automatically, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Have you considered supporting the conversion from lunar calendar to Gregorian calendar?
Only conversion from Gregorian calendar to lunar calendar, lack of conversion from lunar calendar to Gregorian calendar
And it seems that the existing Gregorian calendar cannot be directly returned to the time object after converting to the lunar calendar

@Issues-translate-bot Issues-translate-bot changed the title 是否有考虑支持农历转公历呢 Is there any consideration to support converting the lunar calendar to the Gregorian calendar? Nov 6, 2023
@gouguoyin
Copy link
Member

There are plans to develop.

@gouguoyin gouguoyin added the Under consideration Under consideration label Nov 7, 2023
@gouguoyin
Copy link
Member

gouguoyin commented Jan 24, 2024

Supported since v2.3.6

https://github.com/golang-module/carbon/blob/master/calendar/lunar/README.cn.md

// 将农历 二零二三年腊月十一 转化为 公历
carbon.CreateFromLunar(2023, 12, 11, 0, 0, 0, false).ToDateTimeString() // 2024-01-21 00:00:00
// 将农历 二零二三年二月十一 转化为 公历
carbon.CreateFromLunar(2023, 2, 11, 0, 0, 0, false).ToDateTimeString() // 2023-03-02 00:00:00
// 将农历 二零二三年闰二月十一 转化为 公历
carbon.CreateFromLunar(2023, 2, 11, 0, 0, 0, true).ToDateTimeString() // 2023-04-01 00:00:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Under consideration Under consideration
Development

No branches or pull requests

3 participants