diff --git a/src/pages/saber/day_cycle_power_wave_plot.vue b/src/pages/saber/day_cycle_power_wave_plot.vue index 8e5d4c1..bdca932 100644 --- a/src/pages/saber/day_cycle_power_wave_plot.vue +++ b/src/pages/saber/day_cycle_power_wave_plot.vue @@ -11,12 +11,22 @@ + 纬度带 + + + + + + + 纬度带 + + {{ lat_range.replace(",", " ~ ") }} + + + + 年月 @@ -63,7 +80,7 @@ function renderPath(path: string) { 月份 - + {{ renderPath(path) }} @@ -78,7 +95,11 @@ function renderPath(path: string) { Day - {{ day }} + {{ parseDayOfYear (day.toString()).toLocaleDateString("zh", { + year: 'numeric', + month: 'long', + day: 'numeric', + }) }} diff --git a/src/pages/saber/day_fft_ifft_plot.vue b/src/pages/saber/day_fft_ifft_plot.vue index 336e4c9..18ea32f 100644 --- a/src/pages/saber/day_fft_ifft_plot.vue +++ b/src/pages/saber/day_fft_ifft_plot.vue @@ -11,14 +11,24 @@ + 纬度带 + + + + + + + 纬度带 + + {{ lat_range.replace(",", " ~ ") }} + + + + 年月 @@ -60,7 +77,7 @@ function renderPath(path: string) { 月份 - + {{ renderPath(path) }} @@ -75,7 +92,11 @@ function renderPath(path: string) { Day - {{ day }} + {{ parseDayOfYear(day.toString()).toLocaleDateString("zh", { + year: 'numeric', + month: 'long', + day: 'numeric', + }) }} diff --git a/src/pages/saber/month_power_wave_plot.vue b/src/pages/saber/month_power_wave_plot.vue index 0165a61..95af660 100644 --- a/src/pages/saber/month_power_wave_plot.vue +++ b/src/pages/saber/month_power_wave_plot.vue @@ -11,15 +11,26 @@ + 纬度带 + + + + + + + 纬度带 + + {{ lat_range.replace(",", " ~ ") }} + + + + 年月 @@ -49,7 +66,7 @@ function renderPath(path: string) { 月份 - + {{ renderPath(path) }} diff --git a/src/pages/saber/plot_wave_fitting.vue b/src/pages/saber/plot_wave_fitting.vue index a3fb60e..0c0417d 100644 --- a/src/pages/saber/plot_wave_fitting.vue +++ b/src/pages/saber/plot_wave_fitting.vue @@ -11,12 +11,22 @@ + 纬度带 + + + + + + + 纬度带 + + {{ lat_range.replace(",", " ~ ") }} + + + + 年月 @@ -60,7 +77,7 @@ function renderPath(path: string) { 月份 - + {{ renderPath(path) }} @@ -75,7 +92,11 @@ function renderPath(path: string) { Day - {{ day }} + {{ parseDayOfYear(day.toString()).toLocaleDateString("zh", { + year: 'numeric', + month: 'long', + day: 'numeric', + }) }} diff --git a/src/pages/saber/utils.ts b/src/pages/saber/utils.ts index 9a40997..1a80d0b 100644 --- a/src/pages/saber/utils.ts +++ b/src/pages/saber/utils.ts @@ -16,5 +16,34 @@ async function refreshCurrentSaberDays(path: string) { const data = resp.data.value currentSaberDays.value = data! } +function renderPath(path: string) { + const yearPattern = /\/data\/(\d{4})/ + const year = path.match(yearPattern)?.[1] + const monthPattern = /Temp_O3_(.*)(\d{4})/ + const month_mapping = { + January: '01月', + February: '02月', + March: '03月', + April: '04月', + May: '05月', + June: '06月', + July: '07月', + August: '08月', + September: '09月', + October: '10月', + November: '11月', + December: '12月', + } as const + const month = path.match(monthPattern)?.[1] as keyof typeof month_mapping + return `${year}年${month_mapping[month]}` +} -export { currentSaberDays, refreshCurrentSaberDays, refreshPath, saberPaths } +function parseDayOfYear(dateString: string): Date { + const year = Number.parseInt(dateString.substring(0, 4)) + const dayOfYear = Number.parseInt(dateString.substring(4)) - 1 // subtract 1 because JS dates are 0-based + const date = new Date(year, 0) // Start with January 1st of the year + date.setDate(dayOfYear + 1) // Add the days + return date +} + +export { currentSaberDays, parseDayOfYear, refreshCurrentSaberDays, refreshPath, renderPath, saberPaths }