mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
fix month format error in ios
This commit is contained in:
@@ -57,6 +57,17 @@ function getMonth(date) {
|
|||||||
return moment(date).month() + 1;
|
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) {
|
function getDay(date) {
|
||||||
return moment(date).date();
|
return moment(date).date();
|
||||||
}
|
}
|
||||||
@@ -428,6 +439,7 @@ export default {
|
|||||||
getUnixTime,
|
getUnixTime,
|
||||||
getYear,
|
getYear,
|
||||||
getMonth,
|
getMonth,
|
||||||
|
getYearAndMonth,
|
||||||
getDay,
|
getDay,
|
||||||
getDayOfWeek,
|
getDayOfWeek,
|
||||||
copyObjectTo,
|
copyObjectTo,
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ export default {
|
|||||||
|
|
||||||
const transactionYear = this.$utilities.getYear(transactionTime);
|
const transactionYear = this.$utilities.getYear(transactionTime);
|
||||||
const transactionMonth = this.$utilities.getMonth(transactionTime);
|
const transactionMonth = this.$utilities.getMonth(transactionTime);
|
||||||
|
const transactionYearMonth = this.$utilities.getYearAndMonth(transactionTime);
|
||||||
|
|
||||||
if (currentMonthList && currentMonthList.year === transactionYear && currentMonthList.month === transactionMonth) {
|
if (currentMonthList && currentMonthList.year === transactionYear && currentMonthList.month === transactionMonth) {
|
||||||
currentMonthList.items.push(transaction);
|
currentMonthList.items.push(transaction);
|
||||||
@@ -534,7 +535,7 @@ export default {
|
|||||||
this.transactions.push({
|
this.transactions.push({
|
||||||
year: transactionYear,
|
year: transactionYear,
|
||||||
month: transactionMonth,
|
month: transactionMonth,
|
||||||
yearMonth: `${transactionYear}-${transactionMonth}`,
|
yearMonth: transactionYearMonth,
|
||||||
opened: autoExpand,
|
opened: autoExpand,
|
||||||
items: []
|
items: []
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user