Merge pull request '261105_02_ENH: 문자·이메일·알림톡 예약 발송 시 과거 일시 선택 차단' (#73) from develop into master
Reviewed-on: #73
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
|||||||
useTemplateListQuery,
|
useTemplateListQuery,
|
||||||
useTemplateQuery,
|
useTemplateQuery,
|
||||||
} from '@/query/message'
|
} from '@/query/message'
|
||||||
import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
|
import { getNearestFutureDateTime, isPastReserveDateTime, toReserveSendDt } from '@/lib/datetime'
|
||||||
import type { DialogId } from '@/store/jotai/dialog'
|
import type { DialogId } from '@/store/jotai/dialog'
|
||||||
import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type listHeader } from '@/types/list'
|
import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type listHeader } from '@/types/list'
|
||||||
import { ListHeaderConst } from '@/const/listConst'
|
import { ListHeaderConst } from '@/const/listConst'
|
||||||
@@ -183,6 +183,10 @@ const MessageSendDialog = ({
|
|||||||
alert('예약 발송 일시를 선택해 주세요.')
|
alert('예약 발송 일시를 선택해 주세요.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (scheduleType === 'reserve' && isPastReserveDateTime(reserveAt)) {
|
||||||
|
alert('예약 발송 일시는 현재 시각 이후로 선택해 주세요.')
|
||||||
|
return
|
||||||
|
}
|
||||||
const listFilter = buildListFilter()
|
const listFilter = buildListFilter()
|
||||||
if (target === 'selected' && listFilter.sidSet.length === 0) {
|
if (target === 'selected' && listFilter.sidSet.length === 0) {
|
||||||
alert('수신 대상이 없습니다.')
|
alert('수신 대상이 없습니다.')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
useTemplateQuery,
|
useTemplateQuery,
|
||||||
} from '@/query/message'
|
} from '@/query/message'
|
||||||
import type { TemplateSummary } from '@kri/common/noti-hub'
|
import type { TemplateSummary } from '@kri/common/noti-hub'
|
||||||
import { getNearestFutureDateTime, toReserveSendDt } from '@/lib/datetime'
|
import { getNearestFutureDateTime, isPastReserveDateTime, toReserveSendDt } from '@/lib/datetime'
|
||||||
import type { DialogId } from '@/store/jotai/dialog'
|
import type { DialogId } from '@/store/jotai/dialog'
|
||||||
import type { MessageSendChannel, PhoneVerificationSendData } from '@/types/message'
|
import type { MessageSendChannel, PhoneVerificationSendData } from '@/types/message'
|
||||||
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
|
import MessageSendPreview from '@/components/message-template/MessageSendPreview'
|
||||||
@@ -127,6 +127,10 @@ const SingleMessageSendDialog = ({
|
|||||||
alert('예약 발송 일시를 선택해 주세요.')
|
alert('예약 발송 일시를 선택해 주세요.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (scheduleType === 'reserve' && isPastReserveDateTime(reserveAt)) {
|
||||||
|
alert('예약 발송 일시는 현재 시각 이후로 선택해 주세요.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -32,3 +32,9 @@ const KST_DATE_TIME_FORMAT = new Intl.DateTimeFormat('sv-SE', {
|
|||||||
// 이메일·문자·알림톡 공통 형식이다.
|
// 이메일·문자·알림톡 공통 형식이다.
|
||||||
export const toReserveSendDt = (localDateTime: string): string =>
|
export const toReserveSendDt = (localDateTime: string): string =>
|
||||||
KST_DATE_TIME_FORMAT.format(new Date(localDateTime))
|
KST_DATE_TIME_FORMAT.format(new Date(localDateTime))
|
||||||
|
|
||||||
|
// 예약 발송 일시(로컬 시각)가 현재 시각보다 이전이거나 해석할 수 없으면 true를 반환한다.
|
||||||
|
export const isPastReserveDateTime = (localDateTime: string): boolean => {
|
||||||
|
const time = new Date(localDateTime).getTime()
|
||||||
|
return Number.isNaN(time) || time < Date.now()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user