Fix expired date

This commit is contained in:
Supan Adit Pratama 2020-07-02 19:28:33 +07:00
parent d4c089fb22
commit 5da9a2380a
2 changed files with 15 additions and 2 deletions

View File

@ -104,9 +104,11 @@ class UrlShortenerController extends Controller
$urlExpired = false;
if ($urlAddress['date_expired'] != null) {
$today = Carbon::now();
$today = Carbon::now()->setTime(0, 0, 0);
$urlExpiredDate = Carbon::parse($urlAddress['date_expired']);
$urlExpired = $urlExpiredDate->lessThan($today);
if (!$today->equalTo($urlExpiredDate)) {
$urlExpired = $urlExpiredDate->lessThanOrEqualTo($today);
}
}
if (!$urlExpired) {

View File

@ -59,6 +59,17 @@
<button class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></button>
</td>
</tr>
<tr>
<td>1.</td>
<td>http://www.google.com</td>
<td>http://shorturl.test/s/fffs</td>
<td>5</td>
<td><label class="label label-info">Never</label></td>
<td><label class="label label-success">Yes</label></td>
<td>
<button class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></button>
</td>
</tr>
</table>
</div>
<!-- /.box-body -->