260714_01_ENH: 테스트 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
18
src/lib/datetime.ts
Normal file
18
src/lib/datetime.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export const RESERVE_MINUTE_STEP = 5
|
||||
|
||||
export const getNearestFutureDateTime = (stepMinutes = RESERVE_MINUTE_STEP): string => {
|
||||
const now = new Date()
|
||||
const remainder = now.getMinutes() % stepMinutes
|
||||
if (remainder !== 0) {
|
||||
now.setMinutes(now.getMinutes() + (stepMinutes - remainder))
|
||||
}
|
||||
now.setSeconds(0, 0)
|
||||
|
||||
const year = now.getFullYear()
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(now.getDate()).padStart(2, '0')
|
||||
const hour = String(now.getHours()).padStart(2, '0')
|
||||
const minute = String(now.getMinutes()).padStart(2, '0')
|
||||
|
||||
return `${year}-${month}-${day}T${hour}:${minute}`
|
||||
}
|
||||
Reference in New Issue
Block a user