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

Creating a datetime field in Ponzu #244

Closed
joesb opened this issue May 4, 2018 · 7 comments
Closed

Creating a datetime field in Ponzu #244

joesb opened this issue May 4, 2018 · 7 comments

Comments

@joesb
Copy link

joesb commented May 4, 2018

I'm wondering how to create a content field for a datetime e.g. opening/closing dates of an event. Ideally it would be formatted into year, month, day (etc.) fields in the UI – taking some inspiration from the content publishTime UI, maybe. Granularity of field elements might be adaptable in some way.

Any resources or pointers on how to do it? (I'm new to Go and Ponzu, and hoping to learn some Go by working with Ponzu.)

Many thanks, in anticipation.

@nilslice
Copy link
Contributor

nilslice commented May 9, 2018

@joesb - You can add any arbitrary HTML attributes to the inputs exported from the editor package. Could you try adding the type attr set to date in the input function?

for example:

        editor.Field{
            View: editor.Input("StartDate", p, map[string]string{
                "label":       "StartDate",
                "type":        "date",
                "placeholder": "Enter the Author here",
            }),
        },

@joesb
Copy link
Author

joesb commented May 11, 2018

Thanks for this. I'll have a got and see how far I get.

@nilslice
Copy link
Contributor

@joesb - any luck? going to close out this issue unless you're having problems with it :)

@joesb
Copy link
Author

joesb commented May 17, 2018

Sorry @nilslice - I've not had a chance to get onto it again since asking. Gah!

Do please feel happy closing this issue and I can always ask more questions at a later date. Thanks a gazillion for your help.

@nilslice
Copy link
Contributor

No worries -- I'll leave it open, not a problem at all. Happy to help!

@joshdstockdale
Copy link

@nilslice Your solution worked perfectly for me.

@olliephillips
Copy link
Contributor

Closing this issue. It appears to be answered/resolved. Please reopen if not the case.

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

No branches or pull requests

4 participants