utils.wxs 550 B

123456789101112131415161718192021222324
  1. /* eslint-disable */
  2. function getMonthEndDay(year, month) {
  3. return getDate(year, month - 1, 0).getDate();
  4. }
  5. function compareMonth(date1, date2) {
  6. date1 = getDate(date1);
  7. date2 = getDate(date2);
  8. var year1 = date1.getFullYear();
  9. var year2 = date2.getFullYear();
  10. var month1 = date1.getMonth();
  11. var month2 = date2.getMonth();
  12. if (year1 === year2) {
  13. return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
  14. }
  15. return year1 > year2 ? 1 : -1;
  16. }
  17. module.exports = {
  18. getMonthEndDay: getMonthEndDay,
  19. compareMonth: compareMonth
  20. };