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

how can i show the lunar calendar's bellow the number? #545

Closed
jeff-sun opened this issue May 11, 2024 · 2 comments
Closed

how can i show the lunar calendar's bellow the number? #545

jeff-sun opened this issue May 11, 2024 · 2 comments

Comments

@jeff-sun
Copy link

Library information:

  • Version: [2.5.1]
  • View or Compose module: [View]

Question:

[how can i show the lunar calendar's bellow the number?]
like this
image

@kizitonwose
Copy link
Owner

kizitonwose commented May 11, 2024

You will need to do some conversion with an external library, as this feature is not built into the java.time package. See this

@hoangvuanhdevelopervn
Copy link

hoangvuanhdevelopervn commented May 13, 2024

Use this

 val lunarDay = LunarCoreHelper.convertSolar2Lunar(date.dayOfMonth, date.month.value, 2024, 7.0)
        val solarDate = "${date.dayOfMonth}"
        var lunarDate = "${lunarDay[0]}"
       val lunarMonth = lunarDay[1]
        if (lunarDay[0] == 1) {
          lunarDate = "${lunarDay[0]}/${lunarMonth}"
        }

        val chineseCalendar = ChineseCalendar(convertLocalDateToDate(date))
        val chineseDay = chineseCalendar.get(ChineseCalendar.DAY_OF_MONTH)
        val chineseMonth = chineseCalendar.get(ChineseCalendar.MONTH)
        var lunarDate = "$chineseDay"
        if (chineseDay == 1) {
            lunarDate = "${chineseDay}/${chineseMonth + 1}"
        }
    ChineseCalendar already has in Android Studio, just implement: _import android.icu.util.ChineseCalendar_ and use them.
    
    Link for [LunarCoreHelper](https://github.com/appota/JavaLunarCore/blob/master/lunarcore/src/main/java/com/appota/lunarcore/LunarCoreHelper.java)

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

No branches or pull requests

3 participants