|
|
@@ -7,7 +7,9 @@ import java.time.format.TextStyle; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
public class CalendarGenerator { |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
System.out.println(getMonthDays("2025-07","cn")); |
|
|
|
} |
|
|
|
public static List<DayInfo> getMonthDays(String yearMonth, String language) { |
|
|
|
List<DayInfo> dayInfoList = new ArrayList<>(); |
|
|
|
LocalDate startDate = LocalDate.parse(yearMonth + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
|
|
@@ -30,8 +32,7 @@ public class CalendarGenerator { |
|
|
|
String[] cn = {"一", "二", "三", "四", "五", "六", "日"}; |
|
|
|
String[] jp = {"月", "火", "水", "木", "金", "土", "日"}; |
|
|
|
|
|
|
|
int index = dayOfWeek.getValue() % 7; // 周日是7,但我们希望它在最后一位 |
|
|
|
|
|
|
|
int index = dayOfWeek.getValue() - 1; |
|
|
|
if ("jp".equalsIgnoreCase(language)) { |
|
|
|
return jp[index]; |
|
|
|
} else { |