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