Skip to content

Commit

Permalink
fix: add defaults to test datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjagodic committed Aug 8, 2024
1 parent 18b83ed commit 92875ce
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions dev-test/backends/azure/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/bitbucket/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/git-gateway/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/gitea/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/gitlab/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
1 change: 1 addition & 0 deletions dev-test/backends/proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ collections:
name: date
widget: datetime
format: 'YYYY-MM-DDTHH:mm'
default: 1970-01-01T01:00
- label: Description
name: description
widget: text
Expand Down
3 changes: 1 addition & 2 deletions dev-test/backends/test/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ collections: # A list of collections the CMS should be able to edit
label: 'Publish Date',
name: 'date',
widget: 'datetime',
date_format: 'YYYY-MM-DD',
time_format: 'HH:mm',
format: 'YYYY-MM-DD HH:mm',
default: '{{now}}',
}
- label: 'Cover Image'
name: 'image'
Expand Down
2 changes: 1 addition & 1 deletion packages/decap-cms-widget-datetime/src/DateTimeControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class DateTimeControl extends React.Component {
if (value === '') return value;
const { format, inputFormat } = this.getFormat();

if (value?.replace(/\s+/g, '') === '{{now}}') {
if (typeof value === 'string' && value?.replace(/\s+/g, '') === '{{now}}') {
return this.getNow();
}

Expand Down

0 comments on commit 92875ce

Please sign in to comment.