index.wxs 697B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable */
  2. var utils = require('./utils.wxs');
  3. function getMonths(minDate, maxDate) {
  4. var months = [];
  5. var cursor = getDate(minDate);
  6. cursor.setDate(1);
  7. do {
  8. months.push(cursor.getTime());
  9. cursor.setMonth(cursor.getMonth() + 1);
  10. } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
  11. return months;
  12. }
  13. function getButtonDisabled(type, currentDate) {
  14. if (currentDate == null) {
  15. return true;
  16. }
  17. if (type === 'range') {
  18. return !currentDate[0] || !currentDate[1];
  19. }
  20. if (type === 'multiple') {
  21. return !currentDate.length;
  22. }
  23. return !currentDate;
  24. }
  25. module.exports = {
  26. getMonths: getMonths,
  27. getButtonDisabled: getButtonDisabled
  28. };