Skip to content

Commit ac5d0b2

Browse files
authored
Merge pull request #725 from jaylinski/patch-1
[docs] Clarify change in date-formats
2 parents 058b61b + ebec7be commit ac5d0b2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/upgrading.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ There are 4 main differences on the new API:
131131

132132
1. Token configuration methods were renamed
133133
1. Signature is created via `Builder#getToken()` (instead of `Builder#sign()`)
134-
1. `DateTimeImmutable` objects are now for the registered claims with dates
134+
1. `DateTimeImmutable` objects are now used for the registered claims with dates, which are by default encoded as floats with microseconds as precision
135135
1. Headers should be replicated manually - whenever necessary
136136

137137
Here's the migration:
@@ -178,6 +178,17 @@ Here's the migration:
178178
+ ->getToken($config->signer(), $config->signingKey());
179179
```
180180

181+
#### Date precision
182+
183+
If you want to continue using Unix timestamps, you can use the `withUnixTimestampDates()`-formatter:
184+
185+
```diff
186+
<?php
187+
188+
-$builder = new Builder());
189+
+$builder = $config->builder(ChainedFormatter::withUnixTimestampDates());
190+
```
191+
181192
#### Support for multiple audiences
182193

183194
Even though we didn't officially support multiple audiences, it was technically possible to achieve that by manually setting the `aud` claim to an array with multiple strings.

0 commit comments

Comments
 (0)