16 Jan 2018
```php
// check if expired
Carbon::parse($createdAt)->addSeconds($this->expires)->isPast();
// diff in seconds
$then = Carbon::now()->addMinute();
$now = Carbon::now();
$then->diffInSeconds($now, false) // -60
$now->diffInSeconds($then, false) // 60
```
```js
// parse string
let will_end = '2019-02-01 10:00:00';
let then = moment(new Date(will_end));
// diff in seconds
let then = moment().add(1, 'minute');
let now = moment();
then.diff(now, 'seconds'); // 60
now.diff(then, 'seconds'); // -60
```