fix: Correctly set t.Date() defaults#1062
Merged
SaltyAom merged 2 commits intoelysiajs:mainfrom Feb 16, 2025
aaronsheah:fix-tdate-defaults
Merged
fix: Correctly set t.Date() defaults#1062SaltyAom merged 2 commits intoelysiajs:mainfrom aaronsheah:fix-tdate-defaults
t.Date() defaults#1062SaltyAom merged 2 commits intoelysiajs:mainfrom
aaronsheah:fix-tdate-defaults
Conversation
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
t.Date() defaultst.Date() defaults
SaltyAom
approved these changes
Feb 16, 2025
This was referenced Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently we hardcode the default for the
t.Stringwith 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.Stringwith date and date-time formats, as well ast.Number.I've added a test case in the first commit to demonstrate the bug I'm describing