Skip to content

Commit 53aecc7

Browse files
committed
Fix anchor links
1 parent 83d14eb commit 53aecc7

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

docs/guide/advanced-features/macro.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ Note that the closure is preceded by `static` and uses `self::this()` (available
3232

3333
By following this pattern you ensure other developers of you team (and future you) can rely safely on the assertion: `Carbon::anyMacro()` is equivalent to `Carbon::now()->anyMacro()`. This makes the usage of macros consistent and predictable and ensures developers that any macro can be called safely either statically or dynamically.
3434

35+
<div id="macro-cli"><!-- Link anchor --></div>
36+
3537
The sad part is IDE will not natively your macro method (no auto-completion for the method `diffFromYear` in the example above). But it's no longer a problem thanks to our CLI tool: [carbon-cli](https://github.com/kylekatarnls/carbon-cli) that allows you to generate IDE helper files for your mixins and macros.
3638

39+
<div id="user-settings"><!-- Link anchor --></div>
40+
3741
Macros are the perfect tool to output dates with some settings or user preferences.
3842

3943
```php
@@ -206,7 +210,7 @@ Carbon::resetMacros(); // resetMacros remove all macros and generic macro declar
206210

207211
```
208212

209-
And guess what? all macro methods are also available on [`CarbonInterval`](#api-interval) and [`CarbonPeriod`](#api-period) classes.
213+
And guess what? all macro methods are also available on [`CarbonInterval`](../specialized-use/carbon-interval.html) and [`CarbonPeriod`](../specialized-use/carbon-period.html) classes.
210214

211215
```php
212216

docs/guide/date-time-manipulation/addition-and-subtraction.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ echo $dt->subMonths(2);
110110

111111
This will apply for methods `addMonth(s)`, `subMonth(s)`, `add($x, 'month')`, `sub($x, 'month')` and equivalent quarter methods. But it won't apply for intervals objects or strings like `add(CarbonInterval::month())` or `add('1 month')`.
112112

113-
Static helpers exist but are deprecated. If you're sure to need to apply global setting or work with version 1 of Carbon, [check the overflow static helpers section](#overflow-static-helpers)
113+
Static helpers exist but are deprecated. If you're sure to need to apply global setting or work with version 1 of Carbon, [check the overflow static helpers section](../date-time-manipulation/addition-and-subtraction.html#overflow-static-helpers)
114+
115+
<div id="overflow-static-helpers"><!-- Link anchor --></div>
114116

115117
You can prevent the overflow with `Carbon::useMonthsOverflow(false)`
116118

docs/guide/date-time-manipulation/difference-for-humans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ echo Carbon::create(2018, 2, 26, 4, 29, 43)->longRelativeDiffForHumans(Carbon::c
6262

6363
```
6464

65-
You can also change the locale of the string using `$date->locale('fr')` before the diffForHumans() call. See the [localization](#api-localization) section for more detail.
65+
You can also change the locale of the string using `$date->locale('fr')` before the diffForHumans() call. See the [localization](../getting-started/localization.html) section for more detail.
6666

6767
<div id="diff-for-humans-options"><!-- Link anchor --></div>
6868

docs/guide/date-time-manipulation/difference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`Carbon` `diff()` and `diffAsCarbonInterval()` methods return a `CarbonInterval` (since Carbon v3, while it returned `DateInterval` in the previous versions).
44

5-
Check [CarbonInterval chapter](#api-interval) for more information.
5+
Check [CarbonInterval chapter](../specialized-use/carbon-interval.html) for more information.
66

77
We also provide `diffAsDateInterval()` act like `diff()` but returns a `DateInterval` instance.
88

docs/guide/date-time-manipulation/string-formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ echo $dt;
5757

5858
```
5959

60-
Note: For localization support see the [Localization](#api-localization) section.
60+
Note: For localization support see the [Localization](../getting-started/localization.html) section.

docs/guide/getting-started/instantiation.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Note 1: 2018-02-29 also throws an exception while 2020-02-29 does not since 2020
154154

155155
Note 2: `Carbon::createSafe(2014, 3, 30, 1, 30, 0, 'Europe/London')` also produces an exception as this time is in an hour skipped by the daylight saving time.
156156

157-
Note 3: The PHP native API allow to consider there is a year `0` between `-1` and `1` even if it doesn't regarding Gregorian calendar. That's why years lower than 1 will throw an exception using `createSafe`. Check [isValid()](#doc-method-Carbon-isValid) for year-0 detection.
157+
Note 3: The PHP native API allow to consider there is a year `0` between `-1` and `1` even if it doesn't regarding Gregorian calendar. That's why years lower than 1 will throw an exception using `createSafe`. Check [isValid()](../../develop/reference.html#carbon-isvalid) for year-0 detection.
158158

159159
```php{no-render}
160160
Carbon::createFromFormat($format, $time, $tz);
@@ -243,7 +243,10 @@ echo $carbon->toDateTimeString();
243243

244244
```
245245

246-
Carbon 2 (requiring PHP >= 7.1) perfectly supports microseconds. But if you use Carbon 1 and PHP < 7.1, read our [section about partial microseconds support](#partial-microseconds-support).
246+
<details>
247+
<summary>
248+
Carbon 2 (requiring PHP >= 7.1) perfectly supports microseconds. But if you use Carbon 1 and PHP < 7.1, [click here to read our section about partial microseconds support](#partial-microseconds-support).
249+
</summary>
247250

248251
### Partial microseconds support
249252
Before PHP 7.1 DateTime microseconds are not added to `"now"` instances and cannot be changed afterward, this means:
@@ -279,3 +282,5 @@ var_dump(Carbon::isMicrosecondsFallbackEnabled()); // true
279282
echo Carbon::now()->micro; // microtime in all PHP version
280283

281284
```
285+
286+
</details>

docs/guide/getting-started/localization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In the example above, it will try to find translations in "xx" in priority, then
5959

6060
Note that you can also use an other translator with `Carbon::setTranslator($custom)` as long as the given translator implements [`Symfony\Component\Translation\TranslatorInterface`](https://symfony.com/doc/current/translation.html). And you can get the global default translator using `Carbon::getTranslator()` (and `Carbon::setFallbackLocale($custom)` and `Carbon::getFallbackLocale()` for the fallback locale, setFallbackLocale can be called multiple times to get multiple fallback locales) but as those method will change the behavior globally (including third-party libraries you may have in your app), it might cause unexpected results. You should rather customize translation using custom locales as in the example above.
6161

62-
Carbon embed a default translator that extends Symfony\\Component\\Translation\\Translator You can [check here the methods we added to it](#symfony-translator-details).
62+
Carbon embed a default translator that extends `Symfony\\Component\\Translation\\Translator` You can [check here the methods we added to it](#symfony-translator-details).
6363

6464
You can check what's supported with the following methods:
6565

@@ -128,7 +128,7 @@ echo $notificationForJohn;
128128

129129
You can call any static Carbon method on a factory (make, now, yesterday, tomorrow, parse, create, etc.) Factory (and FactoryImmutable that generates CarbonImmutable instances) are the best way to keep things organized and isolated. As often as possible we recommend you to work with UTC dates, then apply locally (or with a factory) the timezone and the language before displaying dates to the user.
130130

131-
What factory actually do is using the method name as static constructor then call `settings()` method which is a way to group in one call settings of locale, timezone, months/year overflow, etc. ([See references for complete list.](#doc-method-Carbon-settings))
131+
What factory actually do is using the method name as static constructor then call `settings()` method which is a way to group in one call settings of locale, timezone, months/year overflow, etc. ([See references for complete list.](../../develop/reference.html#carbon-settings))
132132

133133
```php
134134
$factory = new Factory([
@@ -563,7 +563,7 @@ echo $translator->getMessages('en')['from_now'];
563563

564564
```
565565

566-
`setMessages` is equivalent to `setTranslations` but you can omit the locale as it will use the current one, so we recommend to use it when you can as in [this previous example](#custom-translations).
566+
`setMessages` is equivalent to `setTranslations` but you can omit the locale as it will use the current one, so we recommend to use it when you can as in [this previous example](#localization).
567567

568568
### Supported Locales
569569
<!--@include: @/parts/localization/supported-locales.md-->

docs/guide/specialized-use/carbon-time-zone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ echo $tz->toOffsetName($summer);
4242

4343
The default timezone is given by [date\_default\_timezone\_get](https://www.php.net/manual/en/function.date-default-timezone-get.php) so it will be driven by the INI settings [date.timezone](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone) but you really should override it at application level using [date\_default\_timezone\_set](https://www.php.net/manual/en/function.date-default-timezone-set.php) and you should set it to `"UTC"`, if you're temped to or already use an other timezone as default, please read the following article: [Always Use UTC Dates And Times](https://medium.com/@kylekatarnls/always-use-utc-dates-and-times-8a8200ca3164).
4444

45-
It explains why UTC is a reliable standard. And this best-practice is even more important in PHP because the PHP DateTime API has many bugs with offsets changes and DST timezones. Some of them appeared on minor versions and even on patch versions (so you can get different results running the same code on PHP 7.1.7 and 7.1.8 for example) and some bugs are not even fixed yet. So we highly recommend to use UTC everywhere and only change the timezone when you want to display a date. See our [first macro example](#user-settings).
45+
It explains why UTC is a reliable standard. And this best-practice is even more important in PHP because the PHP DateTime API has many bugs with offsets changes and DST timezones. Some of them appeared on minor versions and even on patch versions (so you can get different results running the same code on PHP 7.1.7 and 7.1.8 for example) and some bugs are not even fixed yet. So we highly recommend to use UTC everywhere and only change the timezone when you want to display a date. See our [first macro example](../advanced-features/macro.html#user-settings).
4646

4747
While, region timezone ("Continent/City") can have DST and so have variable offset during the year, offset timezone have constant fixed offset:
4848

0 commit comments

Comments
 (0)