VietnameseLunarDateSwift

1.1.1

HoaPham98/VietnameseLunarDateSwift

What's New

Version 1.1.1

2024-09-18T07:26:19Z

feat: Increase code coverage upto 99+%

VietnameseLunarDateSwift

GitHub release (release name instead of tag name)

Library for convert a day to Vietnamese lunar day. The library use Hồ Ngọc Đức's algorimth. Go to the link bellow for more detail http://www.informatik.uni-leipzig.de/~duc/amlich/

Features

  • ✅ Convert from Gregorian Calendar to Vietnamese Lunar Date
  • ✅ Check leap month
  • ✅ Get Thiên Can (Heavenly Stems) and Địa Chi (Earthly Branches) for day, month and year
  • 🎯 String description
  • 🎯 Get Zodiac hours

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code.

You can add Telegraph to your project by choosing the File - Swift Packages - Add Package Dependency option. Use the repository url as specified below and select the version you want to use.

Or you can manually add a Package.swift file to your project with:

dependencies: [
    .package(url: "https://github.com/HoaPham98/VietnameseLunarDateSwift.git")
]

Usage

Convert date from Gregorian Calendar to Vietnamese Lunar Date

import VietnameseLunarDateSwift
....

let date = Date() // 17/09/2024
let lunarDate = LunarDate(from: date)
// or
let newDate = date.lunarDate // 15/08/2024

Check if this date is in leap month

import VietnameseLunarDateSwift
....

let date = calendar.date(from: DateComponents(year: 2023, month: 3, day: 22))! // 01/02/2023 (leap month)
let lunarDate = date.lunarDate

print(lunarDate.day) // 1
print(lunarDate.month) // 2
print(lunarDate.isLeap) // true

Get info

import VietnameseLunarDateSwift
....

et date = Date() // 17/09/2024
let lunarDate = date.lunarDate // 15/08/2024

let info = date.info
// date: Giap than
// month: Quy Dau
// year: Giap Thin

TODO

  • 🎯 String description
  • 🎯 Get Zodiac hours
  • 🎯 Support Cocoapods

Description

  • Swift Tools 5.10.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed May 14 2025 18:39:08 GMT-0900 (Hawaii-Aleutian Daylight Time)