MCPcopy Create free account
hub / github.com/6tail/lunar-java / next

Method next

src/main/java/com/nlf/calendar/Solar.java:777–815  ·  view source on GitHub ↗

获取往后推几天的阳历日期,如果要往前推,则天数用负数 @param days 天数 @return 阳历日期

(int days)

Source from the content-addressed store, hash-verified

775 * @return 阳历日期
776 */
777 public Solar next(int days) {
778 int y = year;
779 int m = month;
780 int d = day;
781 if (1582 == y && 10 == m) {
782 if (d > 4) {
783 d -= 10;
784 }
785 }
786 if (days > 0) {
787 d += days;
788 int daysInMonth = SolarUtil.getDaysOfMonth(y, m);
789 while (d > daysInMonth) {
790 d -= daysInMonth;
791 m++;
792 if (m > 12) {
793 m = 1;
794 y++;
795 }
796 daysInMonth = SolarUtil.getDaysOfMonth(y, m);
797 }
798 } else if (days < 0) {
799 while (d + days <= 0) {
800 m--;
801 if (m < 1) {
802 m = 12;
803 y--;
804 }
805 d += SolarUtil.getDaysOfMonth(y, m);
806 }
807 d += days;
808 }
809 if (1582 == y && 10 == m) {
810 if (d > 4) {
811 d += 10;
812 }
813 }
814 return fromYmdHms(y, m, d, hour, minute, second);
815 }
816
817 /**
818 * 取往后推几天的阳历日期,如果要往前推,则天数用负数

Callers 15

test2021Method · 0.95
testNextMethod · 0.95
test12Method · 0.95
test13Method · 0.95
test14Method · 0.95
test15Method · 0.95
test16Method · 0.95
test17Method · 0.95
test18Method · 0.95
test19Method · 0.95
test24Method · 0.95
test25Method · 0.95

Calls 8

getDaysOfMonthMethod · 0.95
fromYmdHmsMethod · 0.95
getHolidayMethod · 0.95
getYearMethod · 0.95
getMonthMethod · 0.95
getDayMethod · 0.95
getWeekMethod · 0.95
isWorkMethod · 0.95

Tested by 14

test2021Method · 0.76
testNextMethod · 0.76
test12Method · 0.76
test13Method · 0.76
test14Method · 0.76
test15Method · 0.76
test16Method · 0.76
test17Method · 0.76
test18Method · 0.76
test19Method · 0.76
test24Method · 0.76
test25Method · 0.76