Events collection should only use two date/time fields; turn off timestaps for collections
This commit is contained in:
@@ -5,6 +5,7 @@ const EventTypes: CollectionConfig = {
|
||||
admin: {
|
||||
useAsTitle: 'name'
|
||||
},
|
||||
timestamps: false,
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ export interface User {
|
||||
export interface EventType {
|
||||
id: string;
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
@@ -41,10 +39,6 @@ export interface Event {
|
||||
value: string | EventType;
|
||||
relationTo: 'event-types';
|
||||
};
|
||||
startDate: string;
|
||||
endDate?: string;
|
||||
startTime: string;
|
||||
endTime?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user