chenjun

安卓时间对齐

1 import { StringUtils } from './StringUtils'; 1 import { StringUtils } from './StringUtils';
2 import getLunar from './GetLunar'; 2 import getLunar from './GetLunar';
  3 +import { systemDateTime } from '@kit.BasicServicesKit';
3 4
4 /** 5 /**
5 * 日期/时间工具 6 * 日期/时间工具
@@ -436,7 +437,8 @@ export class DateTimeUtils { @@ -436,7 +437,8 @@ export class DateTimeUtils {
436 * 获取文章发布时间 437 * 获取文章发布时间
437 * */ 438 * */
438 public static getCommentTime(publishTime: number): string { 439 public static getCommentTime(publishTime: number): string {
439 - let currentTime: number = new Date().getTime(); 440 + // let currentTime: number = new Date().getTime();
  441 + let currentTime: number = systemDateTime.getTime(false);
440 let timeGap = currentTime - publishTime; 442 let timeGap = currentTime - publishTime;
441 let timeStr = "" 443 let timeStr = ""
442 if (timeGap >= 60 * 60 * 1000 * 48) { 444 if (timeGap >= 60 * 60 * 1000 * 48) {