| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace OrderCountingRecordService;
- use Carbon\Carbon;
- use DateInterval;
- use DatePeriod;
- use DateTime;
- use Tests\TestCase;
- class DateTestTest extends TestCase
- {
- /**
- * @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);
- }
- }
|