diff --git a/components/Header/Forecast.vue b/components/Header/Forecast.vue index 2fac205..4c0a716 100644 --- a/components/Header/Forecast.vue +++ b/components/Header/Forecast.vue @@ -18,7 +18,7 @@ /> { } const getLastHour = () => { - return String(parseInt(genDateFormat('HH')) - 1) + return dayjs(new Date()).subtract(1, 'hour').format('HH') } const getMinute = (format: string) => { diff --git a/locales/en.ts b/locales/en.ts index bafbf82..860fdd5 100644 --- a/locales/en.ts +++ b/locales/en.ts @@ -56,6 +56,10 @@ export default { ], scroll: '👇🏻 Scroll Down' }, + forecast: { + uv: 'UV', + diffusion: 'Air Exposed' + }, resume: { title: 'RESUME' }, diff --git a/locales/ko.ts b/locales/ko.ts index ada6b98..f88bf7e 100644 --- a/locales/ko.ts +++ b/locales/ko.ts @@ -56,6 +56,10 @@ export default { ], scroll: '👇🏻 아래로 스크롤' }, + forecast: { + uv: '자외선', + diffusion: '대기정체' + }, resume: { title: 'RESUME' }, diff --git a/package.json b/package.json index acd0fc6..f1e5530 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "name": "Dewdew", "email": "yeonju.lee1005@gmail.com" }, - "version": "2.1.2", + "version": "2.2.0", "private": true, "scripts": { "build": "nuxt build", diff --git a/stores/locationWeatherData.ts b/stores/locationWeatherData.ts index 1883929..cb56dd2 100644 --- a/stores/locationWeatherData.ts +++ b/stores/locationWeatherData.ts @@ -74,16 +74,16 @@ export const useLocWeatherStore = defineStore('weatherData', () => { const recordWeatherData = (response: WeatherItem[]) => { weatherFirstData.value = { - sky: getWeatherData('sky', filterLastData(response, 'SKY')?.fcstValue ?? 0), - t1h: getWeatherData('t1h', filterLastData(response, 'T1H')?.fcstValue ?? 0), - vec: getWeatherData('vec', Math.floor((parseInt(filterLastData(response, 'VEC')?.fcstValue ?? '0') + 22.5) / 45)), - wsd: getWeatherData('wsd', filterLastData(response, 'WSD')?.fcstValue ?? 0) + sky: getWeatherData('sky', filterWeatherData(response, 'SKY', 0)?.fcstValue ?? 0), + t1h: getWeatherData('t1h', filterWeatherData(response, 'T1H', 0)?.fcstValue ?? 0), + vec: getWeatherData('vec', Math.floor((parseInt(filterWeatherData(response, 'VEC', 0)?.fcstValue ?? '0') + 22.5) / 45)), + wsd: getWeatherData('wsd', filterWeatherData(response, 'WSD', 0)?.fcstValue ?? 0) } weatherSecondData.value = { - pty: getWeatherData('pty', filterLastData(response, 'PTY')?.fcstValue ?? 0), - r1n: getWeatherData('r1n', filterLastData(response, 'RN1')?.fcstValue ?? 0), - reh: getWeatherData('reh', filterLastData(response, 'REH')?.fcstValue ?? 0) + pty: getWeatherData('pty', filterWeatherData(response, 'PTY', 0)?.fcstValue ?? 0), + r1n: getWeatherData('r1n', filterWeatherData(response, 'RN1', 0)?.fcstValue ?? 0), + reh: getWeatherData('reh', filterWeatherData(response, 'REH', 0)?.fcstValue ?? 0) } } @@ -92,8 +92,8 @@ export const useLocWeatherStore = defineStore('weatherData', () => { return typeof data === 'function' ? data(value) : data[value as number] } - const filterLastData = (data: WeatherItem[], category: string) => { - return data.filter((item: WeatherItem) => item.category === category).at(-1) + const filterWeatherData = (data: WeatherItem[], category: string, index:number) => { + return data.filter((item: WeatherItem) => item.category === category).at(index) } return {