- {{- Mode := isset(Queries.mode) ? Queries.mode : "daily" }}
{{- url := "/rankingCalendar?date=" + .ThisMonth.Link + "&mode=" }}
diff --git a/core/rankingCalendar.go b/core/rankingCalendar.go
index 7406aa0..12218ca 100644
--- a/core/rankingCalendar.go
+++ b/core/rankingCalendar.go
@@ -17,6 +17,7 @@ import (
// DayCalendar represents the data for a single day in the ranking calendar
type DayCalendar struct {
DayNumber int // The day of the month
+ DateString string // Pixiv-compatible string that represents the date (format: YYYYMMDD)
ImageURL string // Proxy URL to the image (optional, can be empty when no image is available)
ArtworkLink string // The link to the artwork page for this day
}
@@ -63,7 +64,7 @@ func GetRankingCalendar(auditor *audit.Auditor, r *http.Request, mode string, ye
numDays := daysIn(time.Month(month), year)
// Add days of the month
- calendar, dayCount = addDaysOfMonth(calendar, links, dayCount, numDays)
+ calendar, dayCount = addDaysOfMonth(calendar, links, dayCount, numDays, year, month)
// Add empty days after the last day to complete the week
calendar, dayCount = addEmptyDaysAfter(calendar, dayCount)
@@ -99,7 +100,7 @@ func addEmptyDaysBefore(calendar []DayCalendar, firstDay time.Time, dayCount int
}
// addDaysOfMonth adds the actual days of the month to the calendar.
-func addDaysOfMonth(calendar []DayCalendar, links []string, dayCount int, numDays int) ([]DayCalendar, int) {
+func addDaysOfMonth(calendar []DayCalendar, links []string, dayCount, numDays, year, month int) ([]DayCalendar, int) {
for i := 0; i < numDays; i++ {
day := DayCalendar{
DayNumber: i + 1,
@@ -111,6 +112,7 @@ func addDaysOfMonth(calendar []DayCalendar, links []string, dayCount int, numDay
day.ArtworkLink = fmt.Sprintf("/artworks/%s", artworkID)
}
}
+ day.DateString = fmt.Sprintf("%d%02d%02d", year, month, i + 1)
calendar = append(calendar, day)
dayCount++
}