날짜 처리
This commit is contained in:
@@ -13,7 +13,7 @@ export const convertKTC = (dt, nation = true) => {
|
|||||||
timeZone: 'Asia/Seoul',
|
timeZone: 'Asia/Seoul',
|
||||||
};
|
};
|
||||||
|
|
||||||
return nation ? date.toLocaleString('ko-KR', options) + " KTC" : date.toLocaleString('ko-KR', options);
|
return nation ? date.toLocaleString('ko-KR', options) + " KST" : date.toLocaleString('ko-KR', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const convertKTCDate = (dt) => {
|
export const convertKTCDate = (dt) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ONE_MINUTE_MS } from '../assets/data/adminConstants';
|
import { ONE_MINUTE_MS, ONE_MINUTE_SECOND } from '../assets/data/adminConstants';
|
||||||
|
|
||||||
export const convertStartDateToISO = (date) => {
|
export const convertStartDateToISO = (date) => {
|
||||||
if (!date) return null;
|
if (!date) return null;
|
||||||
@@ -31,6 +31,30 @@ export const getTimeOnly = (dateString) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getDateOnly = (dateString) => {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return date.toISOString().slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
export const msToMinutes = (ms) => {
|
export const msToMinutes = (ms) => {
|
||||||
return ms / ONE_MINUTE_MS;
|
return ms / ONE_MINUTE_MS;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const secondToMinutes = (second) => {
|
||||||
|
return second / ONE_MINUTE_SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const isValidDayRange = (start_dt, end_dt) => {
|
||||||
|
const startDate = new Date(start_dt);
|
||||||
|
const endDate = new Date(end_dt);
|
||||||
|
|
||||||
|
// 시간을 00:00:00으로 설정하여 날짜만 비교
|
||||||
|
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
||||||
|
const endDateOnly = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());
|
||||||
|
|
||||||
|
const diffTime = endDateOnly.getTime() - startDateOnly.getTime();
|
||||||
|
|
||||||
|
const oneDay = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
|
return diffTime >= oneDay;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user