Skip to content

Commit

Permalink
Merge pull request #3101 from briannesbitt/job/update-documentation
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
kylekatarnls authored Nov 4, 2024
2 parents d4a1a66 + de06db4 commit 9222a28
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
70 changes: 35 additions & 35 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ <h1 id="api-introduction">Introduction</h1>
$modifiedImmutable = CarbonImmutable::now()->add(1, 'day');

var_dump($modifiedMutable === $mutable); // bool(true)
var_dump($mutable->isoFormat('dddd D')); // string(8) "Monday 4"
var_dump($modifiedMutable->isoFormat('dddd D')); // string(8) "Monday 4"
var_dump($mutable->isoFormat('dddd D')); // string(9) "Tuesday 5"
var_dump($modifiedMutable->isoFormat('dddd D')); // string(9) "Tuesday 5"
// 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(8) "Sunday 3"
var_dump($modifiedImmutable->isoFormat('dddd D')); // string(8) "Monday 4"
var_dump($immutable->isoFormat('dddd D')); // string(8) "Monday 4"
var_dump($modifiedImmutable->isoFormat('dddd D')); // string(9) "Tuesday 5"
// 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.
Expand Down Expand Up @@ -281,16 +281,16 @@ <h1 id="api-instantiation">Instantiation</h1>

<p>
<pre class="live-editor"><code class="php">$now = Carbon::now();
echo $now; // 2024-11-03 16:16:07
echo $now; // 2024-11-04 14:07:44
echo "\n";
$today = Carbon::today();
echo $today; // 2024-11-03 00:00:00
echo $today; // 2024-11-04 00:00:00
echo "\n";
$tomorrow = Carbon::tomorrow('Europe/London');
echo $tomorrow; // 2024-11-04 00:00:00
echo $tomorrow; // 2024-11-05 00:00:00
echo "\n";
$yesterday = Carbon::yesterday();
echo $yesterday; // 2024-11-02 00:00:00
echo $yesterday; // 2024-11-03 00:00:00
</code></pre>
</p>

Expand Down Expand Up @@ -451,7 +451,7 @@ <h1 id="api-instantiation">Instantiation</h1>
// 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 18:16 right now in Johannesburg.
echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 16:07 right now in Johannesburg.
</code></pre>
</p>

Expand Down Expand Up @@ -705,7 +705,7 @@ <h1 id="api-localization">Localization</h1>
echo "\n";
echo $date->monthName; // novembre
echo "\n";
echo $date->isoFormat('LLLL'); // dimanche 3 novembre 2024 16:16
echo $date->isoFormat('LLLL'); // lundi 4 novembre 2024 14:07
</code></pre>
</p>

Expand Down Expand Up @@ -736,13 +736,13 @@ <h1 id="api-localization">Localization</h1>
echo $toDisplay;
/*
15 juin 2018 14:34
Aujourd’hui à 17:16
Aujourd’hui à 15:07
*/

echo $notificationForJohn;
/*
Jun 15, 2018 7:34 AM
Today at 10:16 AM
Today at 8:07 AM
*/
</code></pre>
</p>
Expand All @@ -769,9 +769,9 @@ <h1 id="api-localization">Localization</h1>
]);
// 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'); // 03/11 9h Asia/Tokyo
echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 04/11 9h Asia/Tokyo
echo "\n";
echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 03/11 0h Asia/Tokyo
echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 04/11 0h Asia/Tokyo

// You can find back which factory created a given object:
$a = $factory->now();
Expand Down Expand Up @@ -1654,21 +1654,21 @@ <h1 id="api-localization">Localization</h1>

<p>
<pre class="live-editor"><code class="php">$date = CarbonImmutable::now();
echo $date->calendar(); // Today at 4:16 PM
echo $date->calendar(); // Today at 2:07 PM
echo "\n";
echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 1:16 PM
echo $date->sub('1 day 3 hours')->calendar(); // Yesterday at 11:07 AM
echo "\n";
echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Thursday at 5:53 AM
echo $date->sub('3 days 10 hours 23 minutes')->calendar(); // Last Friday at 3:44 AM
echo "\n";
echo $date->sub('8 days')->calendar(); // 10/26/2024
echo $date->sub('8 days')->calendar(); // 10/27/2024
echo "\n";
echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 7:16 PM
echo $date->add('1 day 3 hours')->calendar(); // Tomorrow at 5:07 PM
echo "\n";
echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Thursday at 2:39 AM
echo $date->add('3 days 10 hours 23 minutes')->calendar(); // Friday at 12:30 AM
echo "\n";
echo $date->add('8 days')->calendar(); // 11/11/2024
echo $date->add('8 days')->calendar(); // 11/12/2024
echo "\n";
echo $date->locale('fr')->calendar(); // Aujourd’hui à 16:16
echo $date->locale('fr')->calendar(); // Aujourd’hui à 14:07
</code></pre>
</p>

Expand Down Expand Up @@ -5588,7 +5588,7 @@ <h1 id="api-testing">Testing Aids</h1>
var_dump(Carbon::hasTestNow()); // bool(true)
Carbon::setTestNow(); // clear the mock
var_dump(Carbon::hasTestNow()); // bool(false)
echo Carbon::now(); // 2024-11-03 16:16:07
echo Carbon::now(); // 2024-11-04 14:07:44
// Instead of mock and clear mock, you also can use withTestNow():

Carbon::withTestNow('2010-09-15', static function () {
Expand Down Expand Up @@ -5831,12 +5831,12 @@ <h1 id="api-getters">Getters</h1>

// You can get any property dynamically too:
$unit = 'second';
var_dump(Carbon::now()->get($unit)); // int(7)
var_dump(Carbon::now()->get($unit)); // int(44)
// equivalent to:
var_dump(Carbon::now()->$unit); // int(7)
var_dump(Carbon::now()->$unit); // int(44)
// If you have plural unit name, use singularUnit()
$unit = Carbon::singularUnit('seconds');
var_dump(Carbon::now()->get($unit)); // int(7)
var_dump(Carbon::now()->get($unit)); // int(44)
// 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"
Expand Down Expand Up @@ -6413,8 +6413,8 @@ <h1 id="api-comparison">Comparison</h1>

// now is the default param
$dt1 = Carbon::createMidnightDate(2000, 1, 1);
echo $dt1->max(); // 2024-11-03 16:16:07
echo $dt1->maximum(); // 2024-11-03 16:16:07
echo $dt1->max(); // 2024-11-04 14:07:44
echo $dt1->maximum(); // 2024-11-04 14:07:44

// 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
Expand Down Expand Up @@ -7048,10 +7048,10 @@ <h1 id="api-difference">Difference</h1>

$date = Carbon::now()->addSeconds(3666);

echo $date->diffInSeconds(); // -3665.999952
echo $date->diffInMinutes(); // -61.0999985
echo $date->diffInHours(); // -1.0183332983333
echo $date->diffInDays(); // -0.04243055369213
echo $date->diffInSeconds(); // -3665.999955
echo $date->diffInMinutes(); // -61.099998566667
echo $date->diffInHours(); // -1.0183332997222
echo $date->diffInDays(); // -0.042430553773148

$date = Carbon::create(2016, 1, 5, 22, 40, 32);

Expand Down Expand Up @@ -7706,7 +7706,7 @@ <h1 id="api-macro">Macro</h1>
echo "\n";
echo Carbon::tomorrow()->formatForUser(); // Demain à 01:00
echo "\n";
echo Carbon::now()->subDays(3)->formatForUser(); // jeudi dernier à 17:16
echo Carbon::now()->subDays(3)->formatForUser(); // vendredi dernier à 15:07
</code></pre>
</p>

Expand Down Expand Up @@ -7969,7 +7969,7 @@ <h1 id="api-macro">Macro</h1>
echo substr(implode(', ', $dates), 0, 100).'...';
}

dumpDateList(Carbon::getCurrentWeekDays()); // 2024-10-28 00:00:00, 2024-10-29 00:00:00, 2024-10-30 00:00:00, 2024-10-31 00:00:00, 2024-11-01 00:00...
dumpDateList(Carbon::getCurrentWeekDays()); // 2024-11-04 00:00:00, 2024-11-05 00:00:00, 2024-11-06 00:00:00, 2024-11-07 00:00:00, 2024-11-08 00:00...
dumpDateList(Carbon::getCurrentMonthDays()); // 2024-11-01 00:00:00, 2024-11-02 00:00:00, 2024-11-03 00:00:00, 2024-11-04 00:00:00, 2024-11-05 00:00...
dumpDateList(Carbon::now()->subMonth()->getCurrentWeekDays()); // 2024-09-30 00:00:00, 2024-10-01 00:00:00, 2024-10-02 00:00:00, 2024-10-03 00:00:00, 2024-10-04 00:00...
dumpDateList(Carbon::now()->subMonth()->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...
Expand Down Expand Up @@ -8951,7 +8951,7 @@ <h1 id="api-period">CarbonPeriod</h1>
$days[] = $date->format('Y-m-d');
}

echo implode(', ', $days); // 2024-11-03, 2024-11-04, 2024-11-05
echo implode(', ', $days); // 2024-11-04, 2024-11-05, 2024-11-06
</code></pre>
</p>

Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ <h2 id="sponsors">Sponsors</h2>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="Актуальний та повносправний рейтинг онлайн казино України, ґрунтований на відгуках реальних гравців." href="https://uk.onlinecasino.in.ua/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Онлайн казино України" src="https://opencollective-production.s3.us-west-1.amazonaws.com/c0b4b090-eef8-11ec-9cb7-0527a205b226.png" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="Betwinner is an online bookmaker offering sports betting, casino games, and more." href="https://guidebook.betwinner.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Guidebook.BetWinner" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/82cab29a-7002-4924-83bf-2eecb03d07c4/0x0.png" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="O‘zbekistondagi eng yaxshi onlayn kazinolarni topishni istaysizmi? Biz sizga ishonchli va xavfsiz qimor platformalarini taqdim etamiz" href="https://winstar.life/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Onlayn Kazino" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/6275b2c0-18fe-4da8-9339-ab612481971e/flag-round-250.png" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="casino.ua" href="https://casino.ua/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="casino.ua" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/32790ee6-245b-45bd-acf7-7a661fe2cf9f/logo.png" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="OnlineCasinosSpelen" href="https://onlinecasinosspelen.com?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="OnlineCasinosSpelen" src="https://logo.clearbit.com/onlinecasinosspelen.com" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="Актуальний топ-рейтинг українських онлайн казино на гривні! Щоденне оновлення топу та унікальна система ранжування, основана на відгуках гравців!" href="https://onlinecasino.in.ua/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Онлайн Казино Украины" src="https://opencollective-production.s3.us-west-1.amazonaws.com/8fdd8aa0-e273-11ec-a95e-d38fd331cabf.png" width="64" height="64"></a>
<a style="position: relative; margin: 10px; display: inline-block; border: 8px solid transparent; background: white;" title="casinorevisor.com" href="https://casinorevisor.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="casinorevisor.com" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/a69e1789-9f2f-4b24-8b85-c1d4fcecde2f/200x200_white_bg%201.png" width="64" height="64"></a>
Expand All @@ -255,6 +256,7 @@ <h2 id="backers">Backers</h2>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="NonStop Sites" href="https://uk.nonstopcasino.org/non-gamstop-casinos/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="NonStopCasino.org" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/fd7ad905-8752-468f-ad20-582a24cca9d9/non-stop-casino.png" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="List of trusted non GamStop casino reviews" href="https://nongamstopcasinos.org?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="UK NonGamStopCasinos" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cbda0ee1-26ea-4252-9580-f1f9b317b1f7/nongamstopcasinos-uk.png" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="Online TikTok Video Download Tool" href="https://snaptik.pro?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="SnapTik" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/546bcd53-6615-457d-ab21-1db1c52b3af5/logo.jpg" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="Celebian" href="https://celebian.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Celebian" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/98404d29-c226-4ed4-9013-440e89faecde/tft-red--square.jpg" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="Buy Instagram Likes - Real Likes &amp; Instant Delivery!" href="https://blastup.com/buy-instagram-likes?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Blastup" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/955a0beb-9fe8-4753-ad92-fae8ef5382fc/favicon--dark.jpg" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="BestKru" href="https://bestkru.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="BestKru" src="https://logo.clearbit.com/bestkru.com" width="32" height="32"></a>
<a style="position: relative; margin: 5px; display: inline-block; border: 4px solid transparent; border-radius: 50%; overflow: hidden;" title="Buy TikTok Followers is a leading provider of social media growth solutions for TikTok.com." href="https://buytiktokfollowers.co/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Buy TikTok Followers" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/8626c295-9414-4e0c-b228-38ca2704cd68/btf-favicon.png" width="32" height="32"></a>
Expand All @@ -271,7 +273,6 @@ <h2 id="backers">Backers</h2>
</span>
<br />
<span class="open-collective-list open-collective-helpers">
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Celebian" href="https://celebian.com/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Celebian" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/98404d29-c226-4ed4-9013-440e89faecde/tft-red--square.jpg" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="meilleur jeux casino en ligne" href="https://bsc.news/post/meilleur-casino-en-ligne-fiable?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="meilleur jeux casino en ligne" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ad8a1e55-a922-46b8-b69d-21b2769f7a70/casino%20en%20ligne%20france.png" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Hitta rabattkod" href="https://hittarabattkod.nu/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Hitta rabattkod" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c9bba148-dad3-43c9-88b9-1a36f4a58bb7/android-chrome-512x512.png" width="24" height="24"></a>
<a style="position: relative; margin: 3px; display: inline-block; border: 3px solid transparent; border-radius: 50%; overflow: hidden;" title="Jämför försäkringar" href="https://jamforforsakringar.se/?utm_source=opencollective&amp;utm_medium=github&amp;utm_campaign=Carbon" target="_blank"><img alt="Jämför försäkringar" src="https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/dbbd945f-1098-40f7-8b3e-0bf3b969869c/android-chrome-512x512.jpg" width="24" height="24"></a>
Expand Down

0 comments on commit 9222a28

Please sign in to comment.