fix(date): change only in device to UTC
This commit is contained in:
@@ -208,8 +208,8 @@ const DetailDevice = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (formData.start_date && formData.end_date) {
|
||||
const start = dayjs(formData.start_date);
|
||||
const end = dayjs(formData.end_date);
|
||||
const start = dayjs.utc(formData.start_date);
|
||||
const end = dayjs.utc(formData.end_date);
|
||||
|
||||
let periodValue = 'custom';
|
||||
|
||||
@@ -238,7 +238,7 @@ const DetailDevice = (props) => {
|
||||
if (value !== 'custom') {
|
||||
const months = Number(value);
|
||||
|
||||
const startDate = dayjs().startOf('day');
|
||||
const startDate = dayjs.utc().startOf('day');
|
||||
const endDate = startDate
|
||||
.add(months, 'month')
|
||||
.subtract(1, 'day')
|
||||
@@ -470,7 +470,7 @@ const DetailDevice = (props) => {
|
||||
<DatePicker
|
||||
value={
|
||||
formData.reminder_at
|
||||
? dayjs(formData.reminder_at) // ✅ langsung parse ISO
|
||||
? dayjs.utc(formData.reminder_at) // ✅ langsung parse ISO
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
@@ -517,14 +517,14 @@ const DetailDevice = (props) => {
|
||||
<div style={{ display: 'flex', gap: 8, marginBottom: 12 }}>
|
||||
<DatePicker
|
||||
placeholder="Start Date"
|
||||
value={formData.start_date ? dayjs(formData.start_date) : null}
|
||||
value={formData.start_date ? dayjs.utc(formData.start_date) : null}
|
||||
onChange={(date) =>
|
||||
handleDateChange('start_date', date ? date.toISOString() : null)
|
||||
}
|
||||
disabledDate={(current) =>
|
||||
formData.end_date &&
|
||||
current &&
|
||||
current.isAfter(dayjs(formData.end_date), 'day')
|
||||
current.isAfter(dayjs.utc(formData.end_date), 'day')
|
||||
}
|
||||
format="DD-MM-YYYY HH:mm"
|
||||
showTime={{ format: 'HH:mm' }}
|
||||
@@ -533,14 +533,14 @@ const DetailDevice = (props) => {
|
||||
|
||||
<DatePicker
|
||||
placeholder="End Date"
|
||||
value={formData.end_date ? dayjs(formData.end_date) : null}
|
||||
value={formData.end_date ? dayjs.utc(formData.end_date) : null}
|
||||
onChange={(date) =>
|
||||
handleDateChange('end_date', date ? date.toISOString() : null)
|
||||
}
|
||||
disabledDate={(current) =>
|
||||
formData.start_date &&
|
||||
current &&
|
||||
current.isBefore(dayjs(formData.start_date), 'day')
|
||||
current.isBefore(dayjs.utc(formData.start_date), 'day')
|
||||
}
|
||||
format="DD-MM-YYYY HH:mm"
|
||||
showTime={{ format: 'HH:mm' }}
|
||||
@@ -555,7 +555,7 @@ const DetailDevice = (props) => {
|
||||
disabled={formData.period === 'custom'}
|
||||
value={
|
||||
formData.reminder_at_monthly
|
||||
? dayjs(formData.reminder_at_monthly) // ✅ langsung parse ISO
|
||||
? dayjs.utc(formData.reminder_at_monthly) // ✅ langsung parse ISO
|
||||
: null
|
||||
}
|
||||
onChange={(date) =>
|
||||
|
||||
Reference in New Issue
Block a user