Skip to content

Update easter_date docs to reflect PHP 8.3 changes #2643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 7, 2023
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 44 additions & 9 deletions reference/calendar/functions/easter-date.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
Returns the Unix timestamp corresponding to midnight on Easter of
the given year.
</para>
<warning>
<para>
This function will generate a warning if the year is outside
of the range for Unix timestamps (i.e. typically before 1970 or after 2037
on 32bit systems).
</para>
</warning>
<para>
The date of Easter Day was defined by the Council of Nicaea in
AD325 as the Sunday after the first full moon which falls on or
Expand All @@ -49,8 +42,8 @@
<term><parameter>year</parameter></term>
<listitem>
<para>
The year as a number between 1970 an 2037. If omitted or &null;, defaults to the
current year according to the local time.
The year must be a number between 1970 and 2037 for 32-bit systems, or between 1970 and 2,000,000,000 for 64-bit systems.
If omitted or &null;, defaults to the current year according to the local time.
</para>
</listitem>
</varlistentry>
Expand All @@ -75,6 +68,14 @@
</para>
</refsect1>

<refsect1 role="errors">
&reftitle.errors;
<para>
A <classname>ValueError</classname> is thrown if the year is earlier than 1970 or later than 2037
when running on a 32-bit system, or later than 2,000,000,000 on a 64-bit system.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
Expand All @@ -86,12 +87,28 @@
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
On 64-bit systems, the <parameter>year</parameter> parameter now accepts values within the range of 1970 to 2,000,000,000.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
<parameter>year</parameter> is nullable now.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
A <classname>ValueError</classname> is now thrown when
<parameter>year</parameter> is outside the allowed range.
Previously, an <constant>E_WARNING</constant> was raised
and the function returned &false;.
When the given <parameter>year</parameter> is outside the allowed range, it now throws a <classname>ValueError</classname> instead of issuing a warning.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Expand All @@ -110,6 +127,24 @@ echo date("M-d-Y", easter_date(1999)); // Apr-04-1999
echo date("M-d-Y", easter_date(2000)); // Apr-23-2000
echo date("M-d-Y", easter_date(2001)); // Apr-15-2001

?>
]]>
</programlisting>
</example>

<example>
<title>Using <function>easter_date</function> with <classname>DateTime</classname></title>
<programlisting role="php">
<![CDATA[
<?php

$timestamp = easter_date(2023);

$datetime = new \DateTime();
$datetime->setTimestamp($timestamp);

echo $datetime->format('M-d-Y'); // Apr-09-2023

?>
]]>
</programlisting>
Expand Down