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,