Events collection should only use two date/time fields; turn off timestaps for collections

This commit is contained in:
2022-07-22 05:54:33 +01:00
parent 60c1c0759c
commit e154bff4e4
3 changed files with 13 additions and 47 deletions

View File

@@ -5,6 +5,7 @@ const Events: CollectionConfig = {
admin: {
useAsTitle: 'name'
},
timestamps: false,
fields: [
{
name: 'name',
@@ -25,24 +26,26 @@ const Events: CollectionConfig = {
type: 'row',
fields: [
{
name: 'startDate',
label: 'Start Date',
name: 'startTime',
label: 'Start Time',
type: 'date',
required: true,
admin: {
width: '50%',
date: {
pickerAppearance: 'dayOnly'
displayFormat: 'MMM d, yyy HH:mm',
timeFormat: 'HH:mm',
timeIntervals: 15
}
}
},
{
name: 'endDate',
label: 'End Date',
name: 'endTime',
label: 'End Time',
type: 'date',
validate: (val, { siblingData }) => {
const end = new Date(val).getTime();
const start = new Date(siblingData.startDate).getTime();
const start = new Date(siblingData.startTime).getTime();
if (end >= start)
return true;
@@ -52,41 +55,9 @@ const Events: CollectionConfig = {
admin: {
width: '50%',
date: {
pickerAppearance: 'dayOnly'
}
}
}
]
},
{
type: 'row',
fields: [
{
name: 'startTime',
label: 'Start Time',
type: 'date',
required: true,
admin: {
width: '50%',
date: {
pickerAppearance: 'timeOnly',
timeIntervals: 15,
displayFormat: 'HH:mm',
timeFormat: 'HH:mm'
}
}
},
{
name: 'endTime',
label: 'End Time',
type: 'date',
admin: {
width: '50%',
date: {
pickerAppearance: 'timeOnly',
timeIntervals: 15,
displayFormat: 'HH:mm',
timeFormat: 'HH:mm'
displayFormat: 'MMM d, yyy HH:mm',
timeFormat: 'HH:mm',
timeIntervals: 15
}
}
}