orderCountingRecordService = app(OrderCountingRecordService::class); } /** * @test */ public function carbon_date_equals() { $this->assertTrue('2020-11-25' == Carbon::now()->format('Y-m-d')); $this->assertTrue('2020-48' == Carbon::now()->year . '-' . Carbon::now()->week); $this->assertTrue('2020-11' == Carbon::now()->year . '-' . Carbon::now()->month); } /** * @test */ public function compare_date() { $dateStr = '2020-12-30'; $end = Carbon::parse($dateStr)->gt(Carbon::now()) ? Carbon::now()->toDateString() : $dateStr; dd($end); } /** * @test */ public function for_date() { $start = Carbon::now()->subMonth()->toDateString(); $end = Carbon::now()->toDateString(); $unit = '月'; dump($start, $end, $unit); $dateArray =$this->orderCountingRecordService->periodDateToArray($start, $end, $unit); dd($dateArray); } }