should not be ms but s
This commit is contained in:
@@ -225,13 +225,13 @@ export function dateLabel(date, maxDate, minDate) {
|
|||||||
diffMonths += maxDate.getMonth();
|
diffMonths += maxDate.getMonth();
|
||||||
|
|
||||||
// 計算相差的日期,要取整數才能接續下方的邏輯判斷 `diffDays > 0`
|
// 計算相差的日期,要取整數才能接續下方的邏輯判斷 `diffDays > 0`
|
||||||
// 毫秒 * 秒 * 分鐘 * 小時 = 一天的時間量
|
// 秒 * 分鐘 * 小時 = 一天的時間量
|
||||||
const diffDays = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
|
const diffDays = Math.floor(timeDiff / ( 60 * 60 * 24));
|
||||||
|
|
||||||
// 計算相差的小時、分鐘、秒
|
// 計算相差的小時、分鐘、秒
|
||||||
const diffHours = Math.floor(timeDiff / (1000 * 60 * 60));
|
const diffHours = Math.floor(timeDiff / (60 * 60));
|
||||||
const diffMinutes = Math.floor(timeDiff / (1000 * 60));
|
const diffMinutes = Math.floor(timeDiff / 60);
|
||||||
const diffSeconds = Math.floor(timeDiff / 1000);
|
const diffSeconds = Math.floor(timeDiff);
|
||||||
|
|
||||||
// 顯示結果
|
// 顯示結果
|
||||||
if (diffMonths > 0) {
|
if (diffMonths > 0) {
|
||||||
@@ -265,7 +265,7 @@ export function dateLabel(date, maxDate, minDate) {
|
|||||||
export const setTimeStringFormatBaseOnTimeDifference = (minTimeStamp, maxTimeStamp) => {
|
export const setTimeStringFormatBaseOnTimeDifference = (minTimeStamp, maxTimeStamp) => {
|
||||||
const laterDate = new Date(maxTimeStamp);
|
const laterDate = new Date(maxTimeStamp);
|
||||||
const earlyDate = new Date(minTimeStamp);
|
const earlyDate = new Date(minTimeStamp);
|
||||||
const timeDifferenceInSeconds = (laterDate - earlyDate) / 1000;
|
const timeDifferenceInSeconds = (laterDate - earlyDate);
|
||||||
|
|
||||||
let dateFormat;
|
let dateFormat;
|
||||||
if (timeDifferenceInSeconds < 60) {
|
if (timeDifferenceInSeconds < 60) {
|
||||||
|
|||||||
Reference in New Issue
Block a user