Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate certificate with a valid end date on a February 29 #5736

Merged

Conversation

quitejonny
Copy link
Contributor

Problem

We could not generate a certificate with phx.gen.cert today because of an invalid end date.
With a starting date of 2024-02-29 the task would generate an invalid end date of 2025-02-29.

Solution

This PR fixes this bug by calculating an end 365 days in the future.

@chrismccord chrismccord merged commit 546ee2f into phoenixframework:main Feb 29, 2024
4 of 6 checks passed
@chrismccord
Copy link
Member

❤️❤️❤️🐥🔥

mm = month |> Integer.to_string() |> String.pad_leading(2, "0")
dd = day |> Integer.to_string() |> String.pad_leading(2, "0")

yy <> mm <> dd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quitejonny you can also use Date.to_iso8601(date, :basic) which does all of the above. Then I don’t think we need this helper function. :) could you send another patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened a new PR #5738 which uses the Date.to_iso8601 function instead of a custom implementation.

@quitejonny quitejonny deleted the fix-phx-gen-cert-on-feb-29 branch March 1, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants