fix month format error in ios

This commit is contained in:
MaysWind
2020-12-30 01:34:08 +08:00
parent 4f321863a6
commit f42f02bd54
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -57,6 +57,17 @@ function getMonth(date) {
return moment(date).month() + 1;
}
function getYearAndMonth(date) {
const year = getYear(date);
let month = getMonth(date);
if (month < 10) {
month = '0' + month;
}
return `${year}-${month}`;
}
function getDay(date) {
return moment(date).date();
}
@@ -428,6 +439,7 @@ export default {
getUnixTime,
getYear,
getMonth,
getYearAndMonth,
getDay,
getDayOfWeek,
copyObjectTo,
+2 -1
View File
@@ -504,6 +504,7 @@ export default {
const transactionYear = this.$utilities.getYear(transactionTime);
const transactionMonth = this.$utilities.getMonth(transactionTime);
const transactionYearMonth = this.$utilities.getYearAndMonth(transactionTime);
if (currentMonthList && currentMonthList.year === transactionYear && currentMonthList.month === transactionMonth) {
currentMonthList.items.push(transaction);
@@ -534,7 +535,7 @@ export default {
this.transactions.push({
year: transactionYear,
month: transactionMonth,
yearMonth: `${transactionYear}-${transactionMonth}`,
yearMonth: transactionYearMonth,
opened: autoExpand,
items: []
});