math.wxs 675 B

1234567891011121314151617181920212223242526
  1. var filters = {
  2. toFixed: function (value) {
  3. return value.toFixed(0) // 此处2为保留两位小数,保留几位小数,这里写几
  4. }
  5. getFormatDate: function (data) {
  6. var seperator1 = "-";
  7. var year = date.getFullYear();
  8. var month = date.getMonth() + 1;
  9. var strDate = date.getDate();
  10. if (month >= 1 && month <= 9) {
  11. month = "0" + month;
  12. }
  13. if (strDate >= 0 && strDate <= 9) {
  14. strDate = "0" + strDate;
  15. }
  16. var currentdate = year + seperator1 + month + seperator1 + strDate;
  17. return currentdate;
  18. }
  19. }
  20. module.exports = {
  21. toFixed: filters.toFixed
  22. getFormatDate:filters.getFormatDate
  23. }