Skip to content

Commit dba0dbf

Browse files
committed
docs: add user guide for isPast() and isFuture()
1 parent cbad424 commit dba0dbf

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

user_guide_src/source/changelogs/v4.7.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Libraries
181181
- **Image:** Added ``ImageMagickHandler::clearMetadata()`` method to remove image metadata for privacy protection.
182182
- **ResponseTrait:** Added ``paginate``` method to simplify paginated API responses. See :ref:`ResponseTrait::paginate() <api_response_trait_paginate>` for details.
183183
- **Time:** added methods ``Time::addCalendarMonths()`` and ``Time::subCalendarMonths()``
184+
- **Time:** Added ``Time::isPast()`` and ``Time::isFuture()`` convenience methods. See :ref:`isPast <time-comparing-two-times-isPast>` and :ref:`isFuture <time-comparing-two-times-isFuture>` for details.
184185

185186
Commands
186187
========

user_guide_src/source/libraries/time.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,30 @@ Works exactly the same as ``isBefore()`` except checks if the time is after the
393393

394394
.. literalinclude:: time/037.php
395395

396+
.. _time-comparing-two-times-isPast:
397+
398+
isPast()
399+
--------
400+
401+
.. versionadded:: 4.7.0
402+
403+
Determines if the current instance's time is in the past, relative to "now".
404+
It returns a boolean true/false::
405+
406+
.. literalinclude:: time/043.php
407+
408+
.. _time-comparing-two-times-isFuture:
409+
410+
isFuture()
411+
----------
412+
413+
.. versionadded:: 4.7.0
414+
415+
Determines if the current instance's time is in the future, relative to "now".
416+
It returns a boolean true/false::
417+
418+
.. literalinclude:: time/044.php
419+
396420
.. _time-viewing-differences:
397421

398422
Viewing Differences
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
use CodeIgniter\I18n\Time;
4+
5+
$time = Time::parse('yesterday');
6+
echo $time->isPast(); // true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
use CodeIgniter\I18n\Time;
4+
5+
$time = Time::parse('tomorrow');
6+
echo $time->isFuture(); // true

0 commit comments

Comments
 (0)