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

Custom date picker for type string. #2222

Closed
hiepnh610 opened this issue May 4, 2020 · 2 comments
Closed

Custom date picker for type string. #2222

hiepnh610 opened this issue May 4, 2020 · 2 comments
Labels

Comments

@hiepnh610
Copy link

hiepnh610 commented May 4, 2020

I have a schema json like this. Can I create a custom date picker for this?

"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
  "contact_dob": {
    "title": "DOB",
    "type": "string",
    "format": "date-time",
    "widget": {
        "id": "date"
    }
  }
}
@aitboudad
Copy link
Member

The format option is not supported yet in Formly so right now there are two ways: use a map option (#1982 (comment)) or widget where you can pass formlyConfig:

in case you want to use native datetime picker:

{
  "type": "string",
  "format": "date-time",
  "widget": {
+   "formlyConfig": {
+     "templateOptions": { "type": "datetime-local" }
+   }
  }
}

And for a custom dateppicker type:

{
  "type": "string",
  "format": "date-time",
  "widget": {
+   "formlyConfig": {
+     "type": "datepicker"
+   }
  }
}

@hiepnh610
Copy link
Author

hiepnh610 commented May 6, 2020

@aitboudad Tks!!! You saved my life. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants