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

fix: Correctly set t.Date() defaults #1062

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

aaronsheah
Copy link
Contributor

Currently we hardcode the default for the t.String with date and date-time formats to the current time. We should be respecting the defaults that are being provided as part of the DateOptions.

In this PR, we use the default passed in via DateOptions to set the defaults for t.String with date and date-time formats, as well as t.Number.

I've added a test case in the first commit to demonstrate the bug I'm describing

there is a bug currently where the default value is not correctly set for each type in the union type
currently we hardcode the default date to now, but this is messing up the OpenAPI schemas (every generation of the schema changes the default). In this commit we will respect the default set in the options
@aaronsheah aaronsheah changed the title bugfix: Correctly set t.Date() defaults fix: Correctly set t.Date() defaults Feb 14, 2025
@SaltyAom SaltyAom merged commit 10a3df7 into elysiajs:main Feb 16, 2025
1 check passed
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.

2 participants