From 6f960d46a8ee40c5fbc7282a8bfce471ae1ab785 Mon Sep 17 00:00:00 2001 From: Dawn1Ocean <1785590531@qq.com> Date: Fri, 10 May 2024 12:04:21 +0800 Subject: [PATCH] fix: default dutyRecoverTime --- src/pages/index/DutyInfo.tsx | 2 +- src/plain-text/common.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/index/DutyInfo.tsx b/src/pages/index/DutyInfo.tsx index bba7fa5..d25122b 100644 --- a/src/pages/index/DutyInfo.tsx +++ b/src/pages/index/DutyInfo.tsx @@ -15,7 +15,7 @@ export class DutyData { this.currentDuty = '1'; this.otherDutyStart = '2024-03-07T13:30:48.523303'; this.otherDutyEnd = '2024-03-07T16:00:48.523303'; - this.dutyRecoverTime = '明天 13:30'; + this.dutyRecoverTime = '13:30'; this.place = '东三-204'; } diff --git a/src/plain-text/common.ts b/src/plain-text/common.ts index 47fa3ee..739038e 100644 --- a/src/plain-text/common.ts +++ b/src/plain-text/common.ts @@ -1,4 +1,6 @@ -import { Moment } from 'moment'; +import moment, { Moment } from 'moment'; + +const dutyStart = moment().format('YYYY-MM-DD').toString() + ' 13:30:00'; export interface CommonText { createdAtText(time: Moment): string; @@ -14,7 +16,7 @@ export const commonTextZhCn: CommonText = { }, offDutyReason: '正常值班下班', place: '204', - dutyRecoverTime: '明天 13:30', + dutyRecoverTime: moment().isBefore(dutyStart) ? '今天 13:30' : '明天 13:30', zeroMemberOnDuty: '待更新', }; @@ -24,6 +26,8 @@ export const commonTextEnUs: CommonText = { }, offDutyReason: 'Normal Shift', place: 'E3-204', - dutyRecoverTime: 'Tomorrow 13:30', + dutyRecoverTime: moment().isBefore(dutyStart) + ? '13:30 Today' + : '13:30 Tomorrow', zeroMemberOnDuty: 'Wait for update', };