yanlu

fix:直播预告时间问题

1 import { ContentDTO, LiveRoomDataBean } from 'wdBean'; 1 import { ContentDTO, LiveRoomDataBean } from 'wdBean';
2 import { ProcessUtils } from 'wdRouter'; 2 import { ProcessUtils } from 'wdRouter';
3 -import { CommonConstants } from 'wdConstant/Index';  
4 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
5 import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; 4 import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index';
6 import { router } from '@kit.ArkUI'; 5 import { router } from '@kit.ArkUI';
@@ -504,15 +504,12 @@ struct ReserveMorePage { @@ -504,15 +504,12 @@ struct ReserveMorePage {
504 const eventMinutes = eventDateTime.getMinutes(); 504 const eventMinutes = eventDateTime.getMinutes();
505 const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数 505 const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数
506 506
507 - // 计算时间差  
508 - const timeDifference = eventDateTime.getTime() - currentDateTime.getTime();  
509 -  
510 - // 如果事件在24小时内  
511 if (type === 1) { 507 if (type === 1) {
512 - if (timeDifference > 0 && timeDifference <= 24 * 60 * 60 * 1000) { 508 + // 如果是今天
  509 + if (eventDateTime.setHours(0,0,0,0) === currentDateTime.setHours(0,0,0,0)) {
513 return `今天`; 510 return `今天`;
514 } else { 511 } else {
515 - // 如果事件不在24小时内 512 + // 如果事件不在今天
516 const month = eventDateTime.getMonth() + 1; // 月份从0开始 513 const month = eventDateTime.getMonth() + 1; // 月份从0开始
517 const date = eventDateTime.getDate(); 514 const date = eventDateTime.getDate();
518 return `${month}月${date}日`; 515 return `${month}月${date}日`;