From ebec7bed21b27f706158c93dcb72bc0b9ba74a13 Mon Sep 17 00:00:00 2001 From: Jay Linski Date: Tue, 27 Apr 2021 13:28:08 +0200 Subject: [PATCH] Clarify change in date-formats Related to #710 --- docs/upgrading.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/upgrading.md b/docs/upgrading.md index 7610e457..37cef7e4 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -131,7 +131,7 @@ There are 4 main differences on the new API: 1. Token configuration methods were renamed 1. Signature is created via `Builder#getToken()` (instead of `Builder#sign()`) -1. `DateTimeImmutable` objects are now for the registered claims with dates +1. `DateTimeImmutable` objects are now used for the registered claims with dates, which are by default encoded as floats with microseconds as precision 1. Headers should be replicated manually - whenever necessary Here's the migration: @@ -178,6 +178,17 @@ Here's the migration: + ->getToken($config->signer(), $config->signingKey()); ``` +#### Date precision + +If you want to continue using Unix timestamps, you can use the `withUnixTimestampDates()`-formatter: + +```diff +builder(ChainedFormatter::withUnixTimestampDates()); +``` + #### Support for multiple audiences 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.