utils.wxs 558B

1234567891011121314151617181920212223242526
  1. /* eslint-disable */
  2. function getMonthEndDay(year, month) {
  3. return 32 - getDate(year, month - 1, 32).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. };