Files
.github
cypress
dev-test
img
packages
scripts
website
content
blog
docs
widgets
boolean.md
date.md
datetime.md
file.md
hidden.md
image.md
list.md
map.md
markdown.md
number.md
object.md
relation.md
select.md
string.md
text.md
add-to-your-site.md
architecture.md
authentication-backends.md
beta-features.md
cloudinary.md
collection-types.md
configuration-options.md
contributor-guide.md
custom-widgets.md
customization.md
deploy-preview-links.md
examples.md
gatsby.md
intro.md
jekyll.md
middleman.md
netlify-large-media.md
nextjs.md
start-with-a-template.md
update-the-cms-version.md
uploadcare.md
widgets.md
pages
.keep
data
src
static
.babelrc
.gitignore
.nvmrc
.stylelintrc
README.md
gatsby-browser.js
gatsby-config.js
gatsby-node.js
package.json
postcss.config.js
yarn.lock
.all-contributorsrc
.editorconfig
.eslintrc
.gitignore
.nvmrc
.prettierignore
.prettierrc
.stylelintrc
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
azure-pipelines.yml
babel.config.js
custom-preprocessor.js
cypress.json
jest.config.js
lerna.json
package.json
renovate.json
setupTestFramework.js
yarn.lock
static-cms/website/content/docs/widgets/datetime.md

24 lines
1.0 KiB
Markdown
Raw Normal View History

---
title: datetime
label: "DateTime"
---
The datetime widget translates a datetime picker to a datetime string. For saving the date only, use the date widget.
- **Name:** `datetime`
- **UI:** datetime picker
- **Data type:** Moment.js-formatted datetime string
- **Options:**
- `default`: accepts a datetime string, or an empty string to accept blank input; otherwise defaults to current datetime
- `format`: optional; accepts Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/); defaults to raw Date object (if supported by output format)
- `dateFormat`: optional; boolean or Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/). If `true` use default locale format.
- `timeFormat`: optional; boolean or Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/). If `true` use default locale format, `false` hides time-picker.
- **Example:**
```yaml
- label: "Start time"
name: "start"
widget: "datetime"
default: ""
format: "LLL"
```