An open API service indexing awesome lists of open source software.

https://github.com/activecollab/datevalue

Simple extension to Carbon that makes distinction between date and date-time objects
https://github.com/activecollab/datevalue

Last synced: 12 months ago
JSON representation

Simple extension to Carbon that makes distinction between date and date-time objects

Awesome Lists containing this project

README

          

# DateValue

[![Build Status](https://travis-ci.org/activecollab/datevalue.svg?branch=master)](https://travis-ci.org/activecollab/datevalue)

Simple extension to Carbon that makes distinction between date and date-time objects. In order to create a date object, write:

```php
format('Y-m-d') . "\n";
```

In order to create a date and time object, create a `DateTimeValue` instance:

```php
format('Y-m-d H:i:s') . "\n";
```

Since both DateValue, and DateTimeValue classes extend Carbon, you can also use all Carbon methods in your code:

```php
endOfDay();
print $date_time->format('Y-m-d H:i:s') . "\n";
```

To specify a date range, use DateRange class. Ranges can be easily iterated:

```php
assertInstanceOf(DateValueInterface::class, $day);
print $day->format('Y-m-d') . "\n"; // Prints all days from 2017-04-01 to 2017-04-30.
}
```

There are three helper date range classes:

```php