GZZCalendarTool 0.1.2

GZZCalendarTool 0.1.2

Jonzzs 维护。



  • 作者:
  • Jonzzs

GZZCalendarTool

Version License Platform

示例

要运行示例项目,首先克隆仓库,然后从示例目录运行 pod install

安装

GZZCalendarTool 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'GZZCalendarTool'

方法

/**
 获取节假日
 
 @param date 日期
 @return 节假日
 */
+ (nullable NSString *)holidayFromDate:(NSDate *)date;

/**
 获取阴历日期
 
 @param date 日期
 @return 阴历
 */
+ (nullable NSString *)lunarFromDate:(NSDate *)date;

/**
 获取二十四节气
 
 @param date 日期
 @return 节气
 */
+ (nullable NSString *)solarTermFromDate:(NSDate *)date;

使用方法

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd";

NSLog(@"%@", [GZZCalendarTool lunarFromDate:[formatter dateFromString:@"2018-10-09"]]); // 九月
NSLog(@"%@", [GZZCalendarTool lunarFromDate:[formatter dateFromString:@"2018-11-01"]]); // 廿四

NSLog(@"%@", [GZZCalendarTool solarTermFromDate:[formatter dateFromString:@"2018-10-23"]]); // 霜降
NSLog(@"%@", [GZZCalendarTool solarTermFromDate:[formatter dateFromString:@"2018-11-07"]]); // 立冬

NSLog(@"%@", [GZZCalendarTool holidayFromDate:[formatter dateFromString:@"2018-05-13"]]); // 母亲节
NSLog(@"%@", [GZZCalendarTool holidayFromDate:[formatter dateFromString:@"2018-06-17"]]); // 父亲节
NSLog(@"%@", [GZZCalendarTool holidayFromDate:[formatter dateFromString:@"2018-11-29"]]); // 感恩节
NSLog(@"%@", [GZZCalendarTool holidayFromDate:[formatter dateFromString:@"2018-10-01"]]); // 国庆节

作者

Jonzzs, [email protected]

许可证

GZZCalendarTool 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。