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

feat: Implement DatetimeControl and add tests #24

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

TrangPham
Copy link
Contributor

No description provided.

Copy link
Contributor

@NathanFarmer NathanFarmer left a comment

Choose a reason for hiding this comment

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

Can you please add the required asterisk?

src/testSchemas/datetimeSchema.ts Outdated Show resolved Hide resolved
type: "string",
format: "date-time",
scope: "#/properties/The Future is Now",
} as const
Copy link
Contributor

Choose a reason for hiding this comment

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

What does as const achieve? I've also seen a satisfies JSONSchema pattern, and I opted for that.

src/controls/DatetimeControl.tsx Outdated Show resolved Hide resolved
@TrangPham TrangPham marked this pull request as draft March 8, 2024 17:35
@TrangPham TrangPham marked this pull request as ready for review March 20, 2024 23:05
@TrangPham TrangPham changed the title Implement DatetimeControl and add tests feat: Implement DatetimeControl and add tests Mar 20, 2024
package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@DrewHoo DrewHoo left a comment

Choose a reason for hiding this comment

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

G2G if you change peer dependencies to regular dependencies--locale configurability can wait TBH

src/controls/DatetimeControl.tsx Outdated Show resolved Hide resolved
@TrangPham
Copy link
Contributor Author

FYI I updated this to be DateControl since this is what it actually is. DatetimeControl and TimeControl can be added later. Following what jsonforms has: https://jsonforms.io/docs/date-time-picker/

@TrangPham TrangPham requested a review from DrewHoo March 28, 2024 16:03
@TrangPham
Copy link
Contributor Author

@DrewHoo @NathanFarmer Could you review this now? All the tests are passing and it's been rebased

@TrangPham
Copy link
Contributor Author

@DrewHoo Looks like I need your review on it too since you previously requested changes.

@DrewHoo
Copy link
Contributor

DrewHoo commented Apr 12, 2024

@DrewHoo Looks like I need your review on it too since you previously requested changes.

Looks like dependencies still aren't updated? Also the DateControlOptions ought to be differentiated instead of added to a union with TextControlOptions. Something like this might work:

type JsonSchemaTypeToControlOptions<
  T,
> = T extends { type: infer U; format?: infer V }
? U extends "object" 
    ? unknown
    : U extends "string"
      ?  V extends "date" ? DateControlOptions : TextControlOptions
      : ...

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