Skip to content

Commit a3380fc

Browse files
committed
feat: update readme
1 parent 27d8e44 commit a3380fc

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<br>
66
</p>
77

8-
<h1 align="center">Tick v2</h1>
8+
<h1 align="center">Tick</h1>
99

1010
<p align="center">
1111
<a href="https://packagist.org/packages/leafs/date"
@@ -27,19 +27,17 @@
2727
<br />
2828
<br />
2929

30-
Tick is a minimalist PHP library that parses, validates, manipulates, and displays dates and times with a largely DayJS/MomentJS-compatible API. If you use DayJS, you already know how to use Tick.
30+
[Tick](https://leafphp.dev/docs/utils/date.html) is a minimalist PHP library that parses, validates, manipulates, and displays dates and times with a largely DayJS/MomentJS-compatible API. If you use DayJS, you already know how to use Tick.
3131

3232
```php
3333
tick()->now(); // get the current timestamp
3434
tick()->format('YYYY-MM-DD'); // format the current timestamp
3535
tick()->startOf('month')->add(1, 'day')->set('year', 2018)->format('YYYY-MM-DD HH:mm:ss');
3636
```
3737

38-
## Documentation
38+
## Installation
3939

40-
### Installation
41-
42-
You can easily install Leaf using the [Leaf CLI](https://cli.leafphp.dev):
40+
You can install Tick using the [Leaf CLI](https://cli.leafphp.dev):
4341

4442
```bash
4543
leaf install date
@@ -51,14 +49,35 @@ Or with [Composer](https://getcomposer.org/):
5149
composer require leafs/date
5250
```
5351

54-
### API
52+
## API
5553

5654
It's easy to use Tick's APIs to parse, validate, manipulate, and display dates and times.
5755

56+
- Simple, powerful and intuitive API
57+
5858
```php
5959
tick('2018-08-08') // parse
6060
tick()->format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // display
6161
tick()->set('month', 3)->month() // get & set
6262
tick()->add(1, 'year') // manipulate
6363
tick()->isBefore('...') // query
6464
```
65+
66+
- Full support for native PHP DateTime
67+
68+
```php
69+
tick(new DateTime('2018-08-08')) // parse
70+
tick(new DateTime('2018-08-08'))->format('YY-MM-DD') // display
71+
tick(new DateTime('2018-08-08'))->set('month', 3)->month() // get & set
72+
tick(new DateTime('2018-08-08'))->add(1, 'year') // manipulate
73+
tick()->isBefore(new DateTime('2018-08-09')) // query
74+
tick()->toDateTime() // convert to DateTime
75+
```
76+
77+
- Highly recursive API
78+
79+
```php
80+
tick('2018-08-08')->isBefore(
81+
tick('2018-08-09')->add(1, 'day')->set('year', 2018)
82+
);
83+
```

0 commit comments

Comments
 (0)