From 07022bfb3f61091d990c56893cc91a43e9c94cbb Mon Sep 17 00:00:00 2001 From: kylekatarnls <5966783+kylekatarnls@users.noreply.github.com> Date: Fri, 15 Nov 2024 00:26:58 +0000 Subject: [PATCH 1/2] Update documentation --- docs/index.html | 88 ++++++++++++++++++++++++------------------------- index.html | 2 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/docs/index.html b/docs/index.html index c7e1ec2ae..f789ade1d 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(11) "Thursday 14" -var_dump($modifiedMutable->isoFormat('dddd D')); // string(11) "Thursday 14" +var_dump($mutable->isoFormat('dddd D')); // string(11) "Saturday 16" +var_dump($modifiedMutable->isoFormat('dddd D')); // string(11) "Saturday 16" // 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(12) "Wednesday 13" -var_dump($modifiedImmutable->isoFormat('dddd D')); // string(11) "Thursday 14" +var_dump($immutable->isoFormat('dddd D')); // string(9) "Friday 15" +var_dump($modifiedImmutable->isoFormat('dddd D')); // string(11) "Saturday 16" // 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-11-13 18:38:28
+echo $now;                               // 2024-11-15 00:26:57
 echo "\n";
 $today = Carbon::today();
-echo $today;                             // 2024-11-13 00:00:00
+echo $today;                             // 2024-11-15 00:00:00
 echo "\n";
 $tomorrow = Carbon::tomorrow('Europe/London');
-echo $tomorrow;                          // 2024-11-14 00:00:00
+echo $tomorrow;                          // 2024-11-16 00:00:00
 echo "\n";
 $yesterday = Carbon::yesterday();
-echo $yesterday;                         // 2024-11-12 00:00:00
+echo $yesterday;                         // 2024-11-14 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 20:38 right now in Johannesburg. +echo "It's ".$meeting->nowWithSameTz()->format('H:i').' right now in Johannesburg.'; // It's 02:26 right now in Johannesburg.

@@ -705,7 +705,7 @@

Localization

echo "\n"; echo $date->monthName; // novembre echo "\n"; -echo $date->isoFormat('LLLL'); // mercredi 13 novembre 2024 18:38 +echo $date->isoFormat('LLLL'); // vendredi 15 novembre 2024 00:26

@@ -736,13 +736,13 @@

Localization

echo $toDisplay; /* 15 juin 2018 14:34 -Aujourd’hui à 19:38 +Aujourd’hui à 01:26 */ echo $notificationForJohn; /* Jun 15, 2018 7:34 AM -Today at 12:38 PM +Today at 6:26 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'); // 13/11 9h Asia/Tokyo +echo Carbon::today()->setTimezone('Asia/Tokyo')->format('d/m G\h e'); // 15/11 9h Asia/Tokyo echo "\n"; -echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 13/11 0h Asia/Tokyo +echo Carbon::today()->shiftTimezone('Asia/Tokyo')->format('d/m G\h e'); // 15/11 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 6:38 PM
+echo $date->calendar();                                      // Today at 12:26 AM
 echo "\n";
-echo $date->sub('1 day 3 hours')->calendar();                // Yesterday at 3:38 PM
+echo $date->sub('1 day 3 hours')->calendar();                // Last Wednesday at 9:26 PM
 echo "\n";
-echo $date->sub('3 days 10 hours 23 minutes')->calendar();   // Last Sunday at 8:15 AM
+echo $date->sub('3 days 10 hours 23 minutes')->calendar();   // Last Monday at 2:03 PM
 echo "\n";
-echo $date->sub('8 days')->calendar();                       // 11/05/2024
+echo $date->sub('8 days')->calendar();                       // 11/07/2024
 echo "\n";
-echo $date->add('1 day 3 hours')->calendar();                // Tomorrow at 9:38 PM
+echo $date->add('1 day 3 hours')->calendar();                // Tomorrow at 3:26 AM
 echo "\n";
-echo $date->add('3 days 10 hours 23 minutes')->calendar();   // Sunday at 5:01 AM
+echo $date->add('3 days 10 hours 23 minutes')->calendar();   // Monday at 10:49 AM
 echo "\n";
-echo $date->add('8 days')->calendar();                       // 11/21/2024
+echo $date->add('8 days')->calendar();                       // 11/23/2024
 echo "\n";
-echo $date->locale('fr')->calendar();                        // Aujourd’hui à 18:38
+echo $date->locale('fr')->calendar();                        // Aujourd’hui à 00:26
 

@@ -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-11-13 18:38:29 +echo Carbon::now(); // 2024-11-15 00:26:57 // 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)#1152 (3) { +/* object(Carbon\CarbonTimeZone)#2699 (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(29) +var_dump(Carbon::now()->get($unit)); // int(57) // equivalent to: -var_dump(Carbon::now()->$unit); // int(29) +var_dump(Carbon::now()->$unit); // int(57) // If you have plural unit name, use singularUnit() $unit = Carbon::singularUnit('seconds'); -var_dump(Carbon::now()->get($unit)); // int(29) +var_dump(Carbon::now()->get($unit)); // int(57) // 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" @@ -6176,7 +6176,7 @@

Conversion

["formatted"]=> string(19) "2019-02-01 03:45:27" ["timezone"]=> - object(Carbon\CarbonTimeZone)#1162 (3) { + object(Carbon\CarbonTimeZone)#1166 (3) { ["clock":"Carbon\CarbonTimeZone":private]=> NULL ["timezone_type"]=> @@ -6189,7 +6189,7 @@

Conversion

var_dump($dt->toObject()); /* -object(stdClass)#1162 (12) { +object(stdClass)#1166 (12) { ["year"]=> int(2019) ["month"]=> @@ -6213,7 +6213,7 @@

Conversion

["formatted"]=> string(19) "2019-02-01 03:45:27" ["timezone"]=> - object(Carbon\CarbonTimeZone)#536 (3) { + object(Carbon\CarbonTimeZone)#1163 (3) { ["clock":"Carbon\CarbonTimeZone":private]=> NULL ["timezone_type"]=> @@ -6226,7 +6226,7 @@

Conversion

var_dump($dt->toDate()); // Same as $dt->toDateTime() /* -object(DateTime)#1162 (3) { +object(DateTime)#1166 (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)#1161 (3) { +object(DateTimeImmutable)#856 (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-11-13 18:38:29 -echo $dt1->maximum(); // 2024-11-13 18:38:29 +echo $dt1->max(); // 2024-11-15 00:26:57 +echo $dt1->maximum(); // 2024-11-15 00:26:57 // 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 @@ -6909,7 +6909,7 @@

Difference

greater than the other.

-

echo Carbon::now('America/Vancouver')->diffInSeconds(Carbon::now('Europe/London')); // 1.0E-5
+    
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');
@@ -7048,10 +7048,10 @@ 

Difference

$date = Carbon::now()->addSeconds(3666); -echo $date->diffInSeconds(); // -3665.999868 -echo $date->diffInMinutes(); // -61.099996066667 -echo $date->diffInHours(); // -1.0183332433333 -echo $date->diffInDays(); // -0.042430550821759 +echo $date->diffInSeconds(); // -3665.999954 +echo $date->diffInMinutes(); // -61.099998516667 +echo $date->diffInHours(); // -1.0183332986111 +echo $date->diffInDays(); // -0.042430553703704 $date = Carbon::create(2016, 1, 5, 22, 40, 32); @@ -7574,9 +7574,9 @@

Serialization

$dt = Carbon::create(2012, 12, 25, 20, 30, 00, 'Europe/Moscow');
 
-echo serialize($dt);                                              // O:13:"Carbon\Carbon":3:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/Moscow";}
+echo serialize($dt);                                              // O:13:"Carbon\Carbon":4:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/Moscow";s:18:"dumpDateProperties";a:2:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:8:"timezone";s:13:"Europe/Moscow";}}
 // same as:
-echo $dt->serialize();                                            // O:13:"Carbon\Carbon":3:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/Moscow";}
+echo $dt->serialize();                                            // O:13:"Carbon\Carbon":4:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/Moscow";s:18:"dumpDateProperties";a:2:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:8:"timezone";s:13:"Europe/Moscow";}}
 
 $dt = 'O:13:"Carbon\Carbon":3:{s:4:"date";s:26:"2012-12-25 20:30:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/Moscow";}';
 
@@ -7706,7 +7706,7 @@ 

Macro

echo "\n"; echo Carbon::tomorrow()->formatForUser(); // Demain à 01:00 echo "\n"; -echo Carbon::now()->subDays(3)->formatForUser(); // dimanche dernier à 19:38 +echo Carbon::now()->subDays(3)->formatForUser(); // mardi dernier à 01:26

@@ -7971,7 +7971,7 @@

Macro

dumpDateList(Carbon::getCurrentWeekDays()); // 2024-11-11 00:00:00, 2024-11-12 00:00:00, 2024-11-13 00:00:00, 2024-11-14 00:00:00, 2024-11-15 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-10-07 00:00:00, 2024-10-08 00:00:00, 2024-10-09 00:00:00, 2024-10-10 00:00:00, 2024-10-11 00:00... +dumpDateList(Carbon::now()->subMonth()->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::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...

@@ -8951,7 +8951,7 @@

CarbonPeriod

$days[] = $date->format('Y-m-d'); } -echo implode(', ', $days); // 2024-11-13, 2024-11-14, 2024-11-15 +echo implode(', ', $days); // 2024-11-15, 2024-11-16, 2024-11-17

diff --git a/index.html b/index.html index b0fb1e1c4..52446ac1a 100644 --- a/index.html +++ b/index.html @@ -319,11 +319,11 @@

Backers

Real Targeted Traffic TargetedVisitors BB Creative Solutions - TikTokFame GlitteringGenerality Wagerbit People Search Sunset City Mushrooms + TikTokFame Salesforce Instagram Story Viewer IG Downloader From e5273af8ffa50102f9a54e0a9fd9e2ff04dfc240 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Fri, 15 Nov 2024 07:36:05 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI --- tools/generate.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/generate.php b/tools/generate.php index b2ec7f0a6..b0abb625d 100644 --- a/tools/generate.php +++ b/tools/generate.php @@ -314,7 +314,8 @@ function getAllBackers(): array } $isYearly = str_contains(strtolower($member['tier'] ?? ''), 'yearly'); - $monthlyContribution = (float) ($isYearly && $lastTransactionAt > CarbonImmutable::parse('-1 year') + $monthlyContribution = (float) ( + $isYearly && $lastTransactionAt > CarbonImmutable::parse('-1 year') ? ($member['lastTransactionAmount'] / 11.2) // 11.2 instead of 12 to include the discount for yearly subscription : ($member['totalAmountDonated'] / ceil($createdAt->floatDiffInMonths())) ); @@ -333,7 +334,8 @@ function getAllBackers(): array } } - $yearlyContribution = (float) ($isYearly + $yearlyContribution = (float) ( + $isYearly ? (12 * $monthlyContribution) : ($member['totalAmountDonated'] / max(1, $createdAt->floatDiffInYears())) );