timeOptions.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. export default {
  11. shortcuts: [
  12. {
  13. text: '今天',
  14. value () {
  15. const end = new Date()
  16. const start = new Date()
  17. start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()))
  18. return [start, end]
  19. }
  20. },
  21. {
  22. text: '昨天',
  23. value () {
  24. const end = new Date()
  25. const start = new Date()
  26. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 1)))
  27. end.setTime(end.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() -1 )))
  28. return [start, end]
  29. }
  30. },
  31. {
  32. text: '最近7天',
  33. value () {
  34. const end = new Date()
  35. const start = new Date()
  36. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 6)))
  37. return [start, end]
  38. }
  39. },
  40. {
  41. text: '最近30天',
  42. value () {
  43. const end = new Date()
  44. const start = new Date()
  45. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 29)))
  46. return [start, end]
  47. }
  48. },
  49. {
  50. text: '本月',
  51. value () {
  52. const end = new Date()
  53. const start = new Date()
  54. start.setTime(start.setTime(new Date(new Date().getFullYear(), new Date().getMonth(), 1)))
  55. return [start, end]
  56. }
  57. },
  58. {
  59. text: '本年',
  60. value () {
  61. const end = new Date()
  62. const start = new Date()
  63. start.setTime(start.setTime(new Date(new Date().getFullYear(), 0, 1)))
  64. return [start, end]
  65. }
  66. }
  67. ]
  68. }