Skip to content

Commit

Permalink
fix🐛: 修改数据类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
abulo committed Jun 26, 2024
1 parent 551a97f commit bbb6fc5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions admin/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function formatBefore(oldDate) {
let res = "";
if (d2 > 0) {
//是几天前
const days = Number(d2 / 86400);
const days = parseInt(d2 / 86400 + "");
if (days === 1) {
res = "昨天";
} else if (days === 2) {
Expand All @@ -119,15 +119,15 @@ export function formatBefore(oldDate) {
}
} else {
//是今天
const hours = Number(d1 / 3600);
const hours = parseInt(d1 / 3600 + "");
if (hours > 0) {
res = hours + "小时前";
} else {
const minutes = Number(d1 / 60);
const minutes = parseInt(d1 / 60 + "");
if (minutes > 0) {
res = minutes + "分钟前";
} else {
const seconds = Number(d1);
const seconds = d1;
if (seconds > 10) {
res = seconds + "秒前";
} else {
Expand Down

0 comments on commit bbb6fc5

Please sign in to comment.