From f191e8fe11c27a15377c13d2035f903cba40ba8d Mon Sep 17 00:00:00 2001
From: kylekatarnls <5966783+kylekatarnls@users.noreply.github.com>
Date: Wed, 23 Oct 2024 20:55:02 +0000
Subject: [PATCH] Update documentation
---
docs/index.html | 110 ++++++++++++++++++++++++------------------------
index.html | 23 +++++-----
2 files changed, 68 insertions(+), 65 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index fae119683..b5285130f 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -133,13 +133,13 @@
Introduction
$modifiedImmutable = CarbonImmutable::now()->add(1, 'day');
var_dump($modifiedMutable === $mutable); // bool(true)
-var_dump($mutable->isoFormat('dddd D')); // string(12) "Wednesday 16"
-var_dump($modifiedMutable->isoFormat('dddd D')); // string(12) "Wednesday 16"
+var_dump($mutable->isoFormat('dddd D')); // string(11) "Thursday 24"
+var_dump($modifiedMutable->isoFormat('dddd D')); // string(11) "Thursday 24"
// So it means $mutable and $modifiedMutable are the same object
// both set to now + 1 day.
var_dump($modifiedImmutable === $immutable); // bool(false)
-var_dump($immutable->isoFormat('dddd D')); // string(10) "Tuesday 15"
-var_dump($modifiedImmutable->isoFormat('dddd D')); // string(12) "Wednesday 16"
+var_dump($immutable->isoFormat('dddd D')); // string(12) "Wednesday 23"
+var_dump($modifiedImmutable->isoFormat('dddd D')); // string(11) "Thursday 24"
// While $immutable is still set to now and cannot be changed and
// $modifiedImmutable is a new instance created from $immutable
// set to now + 1 day.
@@ -281,16 +281,16 @@ Instantiation
$now = Carbon::now();
-echo $now; // 2024-10-15 00:19:48
+echo $now; // 2024-10-23 20:55:00
echo "\n";
$today = Carbon::today();
-echo $today; // 2024-10-15 00:00:00
+echo $today; // 2024-10-23 00:00:00
echo "\n";
$tomorrow = Carbon::tomorrow('Europe/London');
-echo $tomorrow; // 2024-10-16 00:00:00
+echo $tomorrow; // 2024-10-24 00:00:00
echo "\n";
$yesterday = Carbon::yesterday();
-echo $yesterday; // 2024-10-14 00:00:00
+echo $yesterday; // 2024-10-22 00:00:00
@@ -451,7 +451,7 @@ Instantiation
// 19:15 in Johannesburg
echo 'Meeting starts at '.$meeting->format('H:i').' in Johannesburg.'; // Meeting starts at 19:15 in Johannesburg.
// now in Johannesburg
-echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 02:19 right now in Johannesburg.
+echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 22:55 right now in Johannesburg.
@@ -566,7 +566,7 @@ Localization
In the example above, it will try to find translations in "xx" in priority, then in "xy" if missing, then in "es",
- so here, you get "Xday" from "xx", "Yday" from "xy", and "hace" and "minutos" from "es".
+ so here, you get "Xday" from "xx", "Yhour" from "xy", and "hace" and "minutos" from "es".
Note that you can also use an other translator with Carbon::setTranslator($custom)
as long as the
given translator implements Localization
echo "\n";
echo $date->monthName; // octobre
echo "\n";
-echo $date->isoFormat('LLLL'); // mardi 15 octobre 2024 00:19
+echo $date->isoFormat('LLLL'); // mercredi 23 octobre 2024 20:55
@@ -736,13 +736,13 @@ Localization
echo $toDisplay;
/*
15 juin 2018 14:34
-Aujourd’hui à 02:19
+Aujourd’hui à 22:55
*/
echo $notificationForJohn;
/*
Jun 15, 2018 7:34 AM
-Today at 7:19 PM
+Today at 3:55 PM
*/
@@ -769,9 +769,9 @@ Localization
]);
// Important note: timezone setting calls ->shiftTimezone() and not ->setTimezone(),
// It means it does not just set the timezone, but shift the time too:
-echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 15/10 9h Asia/Tokyo
+echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 23/10 9h Asia/Tokyo
echo "\n";
-echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 15/10 0h Asia/Tokyo
+echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 23/10 0h Asia/Tokyo
// You can find back which factory created a given object:
$a = $factory->now();
@@ -1654,21 +1654,21 @@ Localization
$date = CarbonImmutable::now();
-echo $date->calendar(); // Today at 12:19 AM
+echo $date->calendar(); // Today at 8:55 PM
echo "\n";
-echo $date->sub('1 day 3 hours')->calendar(); // Last Sunday at 9:19 PM
+echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 5:55 PM
echo "\n";
-echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Friday at 1:56 PM
+echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Sunday at 10:32 AM
echo "\n";
-echo $date->sub('8 days')->calendar(); // 10/07/2024
+echo $date->sub('8 days')->calendar(); // 10/15/2024
echo "\n";
-echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 3:19 AM
+echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 11:55 PM
echo "\n";
-echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Friday at 10:42 AM
+echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Sunday at 7:18 AM
echo "\n";
-echo $date->add('8 days')->calendar(); // 10/23/2024
+echo $date->add('8 days')->calendar(); // 10/31/2024
echo "\n";
-echo $date->locale('fr')->calendar(); // Aujourd’hui à 00:19
+echo $date->locale('fr')->calendar(); // Aujourd’hui à 20:55
@@ -5588,7 +5588,7 @@ Testing Aids
var_dump(Carbon::hasTestNow()); // bool(true)
Carbon::setTestNow(); // clear the mock
var_dump(Carbon::hasTestNow()); // bool(false)
-echo Carbon::now(); // 2024-10-15 00:19:49
+echo Carbon::now(); // 2024-10-23 20:55:01
// Instead of mock and clear mock, you also can use withTestNow():
Carbon::withTestNow('2010-09-15', static function () {
@@ -5786,7 +5786,7 @@ Getters
// Returns timezone as CarbonTimeZone
var_dump(Carbon::createFromTimestamp(0, 'Europe/Paris')->getTimezone());
-/* object(Carbon\CarbonTimeZone)#533 (3) {
+/* object(Carbon\CarbonTimeZone)#921 (3) {
["clock":"Carbon\CarbonTimeZone":private]=>
NULL
["timezone_type"]=>
@@ -5831,12 +5831,12 @@ Getters
// You can get any property dynamically too:
$unit = 'second';
-var_dump(Carbon::now()->get($unit)); // int(49)
+var_dump(Carbon::now()->get($unit)); // int(1)
// equivalent to:
-var_dump(Carbon::now()->$unit); // int(49)
+var_dump(Carbon::now()->$unit); // int(1)
// If you have plural unit name, use singularUnit()
$unit = Carbon::singularUnit('seconds');
-var_dump(Carbon::now()->get($unit)); // int(49)
+var_dump(Carbon::now()->get($unit)); // int(1)
// Prefer using singularUnit() because some plurals are not the word with S:
var_dump(Carbon::pluralUnit('century')); // string(9) "centuries"
var_dump(Carbon::pluralUnit('millennium')); // string(9) "millennia"
@@ -5912,23 +5912,23 @@ Weeks
var_dump($en->firstWeekDay); // int(0)
var_dump($en->lastWeekDay); // int(6)
-var_dump($en->startOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-13 00:00"
-var_dump($en->endOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-19 23:59"
+var_dump($en->startOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-20 00:00"
+var_dump($en->endOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-26 23:59"
echo "-----------\n";
// We still can force to use an other day as start/end of week
$start = $en->startOfWeek(Carbon::TUESDAY);
$end = $en->endOfWeek(Carbon::MONDAY);
-var_dump($start->format('Y-m-d H:i')); // string(16) "2024-10-15 00:00"
-var_dump($end->format('Y-m-d H:i')); // string(16) "2024-10-21 23:59"
+var_dump($start->format('Y-m-d H:i')); // string(16) "2024-10-22 00:00"
+var_dump($end->format('Y-m-d H:i')); // string(16) "2024-10-28 23:59"
echo "-----------\n";
var_dump($ar->firstWeekDay); // int(6)
var_dump($ar->lastWeekDay); // int(5)
-var_dump($ar->startOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-12 00:00"
-var_dump($ar->endOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-18 23:59"
+var_dump($ar->startOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-19 00:00"
+var_dump($ar->endOfWeek()->format('Y-m-d H:i')); // string(16) "2024-10-25 23:59"
$en = CarbonImmutable::parse('2015-02-05'); // use en_US as default locale
@@ -6176,7 +6176,7 @@ Conversion
["formatted"]=>
string(19) "2019-02-01 03:45:27"
["timezone"]=>
- object(Carbon\CarbonTimeZone)#1096 (3) {
+ object(Carbon\CarbonTimeZone)#1093 (3) {
["clock":"Carbon\CarbonTimeZone":private]=>
NULL
["timezone_type"]=>
@@ -6189,7 +6189,7 @@ Conversion
var_dump($dt->toObject());
/*
-object(stdClass)#1096 (12) {
+object(stdClass)#1093 (12) {
["year"]=>
int(2019)
["month"]=>
@@ -6213,7 +6213,7 @@ Conversion
["formatted"]=>
string(19) "2019-02-01 03:45:27"
["timezone"]=>
- object(Carbon\CarbonTimeZone)#1093 (3) {
+ object(Carbon\CarbonTimeZone)#1378 (3) {
["clock":"Carbon\CarbonTimeZone":private]=>
NULL
["timezone_type"]=>
@@ -6226,7 +6226,7 @@ Conversion
var_dump($dt->toDate()); // Same as $dt->toDateTime()
/*
-object(DateTime)#1096 (3) {
+object(DateTime)#1093 (3) {
["date"]=>
string(26) "2019-02-01 03:45:27.612584"
["timezone_type"]=>
@@ -6240,7 +6240,7 @@ Conversion
// to both DateTime and DateTimeImmutable
var_dump($dt->toDateTimeImmutable());
/*
-object(DateTimeImmutable)#1096 (3) {
+object(DateTimeImmutable)#1092 (3) {
["date"]=>
string(26) "2019-02-01 03:45:27.612584"
["timezone_type"]=>
@@ -6413,8 +6413,8 @@ Comparison
// now is the default param
$dt1 = Carbon::createMidnightDate(2000, 1, 1);
-echo $dt1->max(); // 2024-10-15 00:19:49
-echo $dt1->maximum(); // 2024-10-15 00:19:49
+echo $dt1->max(); // 2024-10-23 20:55:01
+echo $dt1->maximum(); // 2024-10-23 20:55:01
// Remember min and max PHP native function work fine with dates too:
echo max(Carbon::create('2002-03-15'), Carbon::create('2003-01-07'), Carbon::create('2002-08-25')); // 2003-01-07 00:00:00
@@ -6821,27 +6821,27 @@ Addition and Subtraction
// Add hours without overflowing day
echo $dt->addUnitNoOverflow('hour', 7, 'day'); // 2018-08-30 19:00:00
echo "\n";
-echo $dt->addUnitNoOverflow('hour', 14, 'day'); // 2018-08-30 23:59:59
+echo $dt->addUnitNoOverflow('hour', 14, 'day'); // 2018-08-31 02:00:00
echo "\n";
-echo $dt->addUnitNoOverflow('hour', 48, 'day'); // 2018-08-30 23:59:59
+echo $dt->addUnitNoOverflow('hour', 48, 'day'); // 2018-09-01 12:00:00
echo "\n-------\n";
// Substract hours without overflowing day
echo $dt->subUnitNoOverflow('hour', 7, 'day'); // 2018-08-30 05:00:00
echo "\n";
-echo $dt->subUnitNoOverflow('hour', 14, 'day'); // 2018-08-30 00:00:00
+echo $dt->subUnitNoOverflow('hour', 14, 'day'); // 2018-08-29 22:00:00
echo "\n";
-echo $dt->subUnitNoOverflow('hour', 48, 'day'); // 2018-08-30 00:00:00
+echo $dt->subUnitNoOverflow('hour', 48, 'day'); // 2018-08-28 12:00:00
echo "\n-------\n";
// Set hours without overflowing day
-echo $dt->setUnitNoOverflow('hour', -7, 'day'); // 2018-08-30 00:00:00
+echo $dt->setUnitNoOverflow('hour', -7, 'day'); // 2018-08-29 17:00:00
echo "\n";
echo $dt->setUnitNoOverflow('hour', 14, 'day'); // 2018-08-30 14:00:00
echo "\n";
-echo $dt->setUnitNoOverflow('hour', 25, 'day'); // 2018-08-30 23:59:59
+echo $dt->setUnitNoOverflow('hour', 25, 'day'); // 2018-08-31 01:00:00
echo "\n-------\n";
@@ -6850,7 +6850,7 @@ Addition and Subtraction
echo "\n";
echo $dt->addUnitNoOverflow('hour', 14, 'month'); // 2018-08-31 02:00:00
echo "\n";
-echo $dt->addUnitNoOverflow('hour', 48, 'month'); // 2018-08-31 23:59:59
+echo $dt->addUnitNoOverflow('hour', 48, 'month'); // 2018-09-01 12:00:00
@@ -6909,7 +6909,7 @@ Difference
greater than the other.
-
echo Carbon::now('America/Vancouver')->diffInSeconds(Carbon::now('Europe/London')); // 5.0E-6
+ echo Carbon::now('America/Vancouver')->diffInSeconds(Carbon::now('Europe/London')); // 4.0E-6
$dtOttawa = Carbon::createMidnightDate(2000, 1, 1, 'America/Toronto');
$dtVancouver = Carbon::createMidnightDate(2000, 1, 1, 'America/Vancouver');
@@ -7050,8 +7050,8 @@ Difference
echo $date->diffInSeconds(); // -3665.999952
echo $date->diffInMinutes(); // -61.099998483333
-echo $date->diffInHours(); // -1.0183332975
-echo $date->diffInDays(); // -0.042430553645833
+echo $date->diffInHours(); // -1.0183332977778
+echo $date->diffInDays(); // -0.042430553657407
$date = Carbon::create(2016, 1, 5, 22, 40, 32);
@@ -7706,7 +7706,7 @@ Macro
echo "\n";
echo Carbon::tomorrow()->formatForUser(); // Demain à 02:00
echo "\n";
-echo Carbon::now()->subDays(3)->formatForUser(); // samedi dernier à 02:19
+echo Carbon::now()->subDays(3)->formatForUser(); // dimanche dernier à 22:55
@@ -7969,9 +7969,9 @@ Macro
echo substr(implode(', ', $dates), 0, 100).'...';
}
-dumpDateList(Carbon::getCurrentWeekDays()); // 2024-10-14 00:00:00, 2024-10-15 00:00:00, 2024-10-16 00:00:00, 2024-10-17 00:00:00, 2024-10-18 00:00...
+dumpDateList(Carbon::getCurrentWeekDays()); // 2024-10-21 00:00:00, 2024-10-22 00:00:00, 2024-10-23 00:00:00, 2024-10-24 00:00:00, 2024-10-25 00:00...
dumpDateList(Carbon::getCurrentMonthDays()); // 2024-10-01 00:00:00, 2024-10-02 00:00:00, 2024-10-03 00:00:00, 2024-10-04 00:00:00, 2024-10-05 00:00...
-dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2024-09-09 00:00:00, 2024-09-10 00:00:00, 2024-09-11 00:00:00, 2024-09-12 00:00:00, 2024-09-13 00:00...
+dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2024-09-23 00:00:00, 2024-09-24 00:00:00, 2024-09-25 00:00:00, 2024-09-26 00:00:00, 2024-09-27 00:00...
dumpDateList(Carbon::now()->subMonth()->getCurrentMonthDays()); // 2024-09-01 00:00:00, 2024-09-02 00:00:00, 2024-09-03 00:00:00, 2024-09-04 00:00:00, 2024-09-05 00:00...
@@ -8951,7 +8951,7 @@ CarbonPeriod
$days[] = $date->format('Y-m-d');
}
-echo implode(', ', $days); // 2024-10-15, 2024-10-16, 2024-10-17
+echo implode(', ', $days); // 2024-10-23, 2024-10-24, 2024-10-25
diff --git a/index.html b/index.html
index f43755f63..e258a8811 100644
--- a/index.html
+++ b/index.html
@@ -229,12 +229,13 @@
-
+
+
@@ -247,6 +248,7 @@ Backers
+
@@ -262,31 +264,32 @@ Backers
-
-
-
+
+
-
+
+
+
-
-
+
+
@@ -294,22 +297,22 @@ Backers
-
+
+
-
-
+