|
@@ -1,6 +1,6 @@
|
1
|
1
|
import { Component, OnInit } from "@angular/core";
|
2
|
2
|
import { ActivatedRoute, Router } from "@angular/router";
|
3
|
|
-import { differenceInCalendarDays, endOfMonth, endOfYear } from "date-fns";
|
|
3
|
+import { differenceInCalendarDays, endOfMonth, endOfYear, startOfDay, format, endOfDay, startOfMonth, startOfYear } from "date-fns";
|
4
|
4
|
|
5
|
5
|
import { MainService } from "../../services/main.service";
|
6
|
6
|
import { DateService } from "../../services/date.service";
|
|
@@ -316,8 +316,7 @@ export class OrderStatisticsComponent implements OnInit {
|
316
|
316
|
this.startDate = this.endDate = "";
|
317
|
317
|
return;
|
318
|
318
|
}
|
319
|
|
- this.startDate =
|
320
|
|
- result.getFullYear() + "-" + (result.getMonth() + 1) + "-01";
|
|
319
|
+ this.startDate = format(startOfMonth(result), 'yyyy-MM-dd');
|
321
|
320
|
// this.endDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
|
322
|
321
|
}
|
323
|
322
|
changeMonthEnd(result?) {
|
|
@@ -332,7 +331,7 @@ export class OrderStatisticsComponent implements OnInit {
|
332
|
331
|
return;
|
333
|
332
|
}
|
334
|
333
|
// this.startDate = result.getFullYear() + '-' + (result.getMonth() + 1) + '-01';
|
335
|
|
- this.endDate = result.getFullYear() + "-" + (result.getMonth() + 1) + "-31";
|
|
334
|
+ this.endDate = format(endOfMonth(result), 'yyyy-MM-dd');
|
336
|
335
|
}
|
337
|
336
|
// 年份选择
|
338
|
337
|
changeYearStart(result?) {
|
|
@@ -346,7 +345,7 @@ export class OrderStatisticsComponent implements OnInit {
|
346
|
345
|
this.startDate = this.endDate = "";
|
347
|
346
|
return;
|
348
|
347
|
}
|
349
|
|
- this.startDate = result.getFullYear() + "-01-01";
|
|
348
|
+ this.startDate = format(startOfYear(result), 'yyyy-MM-dd');
|
350
|
349
|
// this.endDate = result.getFullYear() + '-01-01';
|
351
|
350
|
}
|
352
|
351
|
changeYearEnd(result?) {
|
|
@@ -360,7 +359,7 @@ export class OrderStatisticsComponent implements OnInit {
|
360
|
359
|
this.startDate = this.endDate = "";
|
361
|
360
|
return;
|
362
|
361
|
}
|
363
|
|
- this.endDate = result.getFullYear() + "-12-31";
|
|
362
|
+ this.endDate = format(endOfYear(result), 'yyyy-MM-dd');
|
364
|
363
|
}
|
365
|
364
|
|
366
|
365
|
// 日期选择 快速修改时间区间
|