Skip to content

Add date and time support client-side #28

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanielOrtel
Copy link

Since these two fields are basically represented as strings and act exactly like short and long answer, this is a pretty safe and trivial addition.

Tests are passing, and tested manually to see the whole submit flow, everything works as expected.

Test form, in case you need it

}

export interface DateField extends BaseField {
type: 'DATE'
Copy link
Author

@DanielOrtel DanielOrtel May 10, 2022

Choose a reason for hiding this comment

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

DATE and TIME fields act exactly like SHORT_ANSWER and LONG_ANSWER from what I could see, since they're basically just strings, so it makes more sense to group them together

Copy link
Owner

@francisconeves97 francisconeves97 May 16, 2022

Choose a reason for hiding this comment

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

Are their format the same? Would it make sense to add some validation regarding the date format? I will have to take a deeper look into how google forms handles these type of inputs

@DanielOrtel
Copy link
Author

Hey, @francisconeves97, sorry for the ping, but was wondering if this is something that you could take a quick look at. I'm sort of on a deadline, and I'd be nice if this was available in the package

@francisconeves97
Copy link
Owner

Hey @DanielOrtel! I am sorry for taking so long to look into this, past couple of weeks have been very busy for me :/ I will try to check it asap as soon as I can. I am sorry for the impact on your project

case 'DATE':
questionInput = <DateInput id={id} />
break
case 'TIMe':
Copy link
Owner

Choose a reason for hiding this comment

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

Is this a typo?

Copy link
Author

Choose a reason for hiding this comment

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

yep, will fix

}

export interface DateField extends BaseField {
type: 'DATE'
Copy link
Owner

@francisconeves97 francisconeves97 May 16, 2022

Choose a reason for hiding this comment

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

Are their format the same? Would it make sense to add some validation regarding the date format? I will have to take a deeper look into how google forms handles these type of inputs

@DanielOrtel
Copy link
Author

Are their format the same? Would it make sense to add some validation regarding the date format? I will have to take a deeper look into how google forms handles these type of inputs

From what I could test, the DATE and TIME fields are exactly the same as the SHORT_ANSWER input in every way. Google does not validate the format on the backend, it merely presents a date-picker/time-picker component on the client side when it sees the Date/Time formats, but programatically, it will accept any string, including foo in the response.

@DanielOrtel
Copy link
Author

also, sorry about not being up-to-date on this, we've opted to drop the date field, and just use a text field for that, since we had to release a week ago, so this was no longer that high priority. But I'll try to address the concerns you raised shortly. It would still be useful to have

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