fix the problem that the transaction date not display sometimes in transaction list page
This commit is contained in:
@@ -105,6 +105,11 @@ export function getUnixTime(date) {
|
||||
return moment(date).unix();
|
||||
}
|
||||
|
||||
export function getShortDate(date) {
|
||||
date = moment(date);
|
||||
return date.year() + '-' + (date.month() + 1) + '-' + date.date();
|
||||
}
|
||||
|
||||
export function getYear(date) {
|
||||
return moment(date).year();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { isNumber, isString } from '@/lib/common.js';
|
||||
import {
|
||||
getTimezoneOffsetMinutes,
|
||||
parseDateFromUnixTime,
|
||||
getShortDate,
|
||||
getYear,
|
||||
getMonth,
|
||||
getYearAndMonth,
|
||||
@@ -238,6 +239,7 @@ function fillTransactionObject(state, transaction, currentUtcOffset) {
|
||||
const transactionCategoriesStore = useTransactionCategoriesStore();
|
||||
const transactionTime = parseDateFromUnixTime(transaction.time, transaction.utcOffset, currentUtcOffset);
|
||||
|
||||
transaction.date = getShortDate(transactionTime);
|
||||
transaction.day = getDay(transactionTime);
|
||||
transaction.dayOfWeek = getDayOfWeekName(transactionTime);
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
:class="{ 'disabled': loading, 'has-bottom-border': idx < transactions.length - 1 }"
|
||||
v-for="(transaction, idx) in transactions">
|
||||
<tr class="transaction-list-row-date no-hover text-sm"
|
||||
v-if="idx === 0 || (idx > 0 && (transaction.day !== transactions[idx - 1].day))">
|
||||
v-if="idx === 0 || (idx > 0 && (transaction.date !== transactions[idx - 1].date))">
|
||||
<td colspan="5" class="font-weight-bold">
|
||||
<div class="d-flex align-center">
|
||||
<span>{{ getLongDate(transaction) }}</span>
|
||||
|
||||
Reference in New Issue
Block a user