Skip to content

Commit

Permalink
feat: 현재 날짜 기준으로 기상정보 불러오기 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Db0111 committed Aug 25, 2024
1 parent 12ca670 commit fa07391
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/service/weather.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { WeatherResponse } from '@/types/weather';

const date = new Date();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const year = date.getFullYear().toString();
const day = date.getDate().toString().padStart(2, '0');
const hour = date.getHours().toString().padStart(2, '0');
const minute = date.getMinutes().toString().padStart(2, '0');
const second = date.getSeconds().toString().padStart(2, '0');

const now = `${year}-${month}-${day}T${hour}:${minute}:${second}`;

export async function getWeather(): Promise<WeatherResponse> {
const offset = 1000 * 60 * 60 * 9;
const KTCnow = new Date(new Date().getTime() + offset);
Expand Down

0 comments on commit fa07391

Please sign in to comment.