Doc #78000 [Ver->Csd]: Missing description of reltext's different behaviors (static & method on object)

[email protected] Thu, 02 Jun 2022 16:03:34 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=78000&edit=1

 ID:                 78000
 Updated by:         [email protected]
 Reported by:        ssimo3 at lsuhsc dot edu
 Summary:            Missing description of reltext's different behaviors
                     (static & method on object)
-Status:             Verified
+Status:             Closed
 Type:               Documentation Problem
 Package:            Date/time related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of derickr
Revision: https://github.com/php/doc-en/commit/26e0c6ef75d4a9a218462a5153c604e37b59f3c7
Log: Fixed bug #78000: Missing description of reltext's different behaviors (static &amp; method on object)


Previous Comments:
------------------------------------------------------------------------
[2019-05-10 14:22:02] ssimo3 at lsuhsc dot edu

Description:
------------
---
From manual page: https://php.net/datetime.formats.relative
---

What is missing is the following paragraph:

"The referent of the reltext keywords depend on the context in which the relative format string is used. If used with a static method or function, the referent is the current system timestamp. However, if used in DateTime::modify() or DateTimeImmutable::modify(), the referent is the object on which the modify() method is called."

Thank you! 

Test script:
---------------
<?php
header("Content-Type: text/plain");
$thisMonthDateTime = date_create("first day of this month");
echo $thisMonthDateTime->format("Y-m-d") . "\r\n";
$januaryDateTime = DateTime::createFromFormat("Y-m-d", "2019-01-15");
$januaryDateTime->modify("first day of this month");
echo $januaryDateTime->format("Y-m-d");

Actual result:
--------------
The two displayed dates are different, AS THEY SHOULD BE. What is missing is DOCUMENTATION of the behavior.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78000&edit=1