feat: add new pickerAppearance option 'monthOnly'
This commit is contained in:
63
test/fields/collections/Date/index.ts
Normal file
63
test/fields/collections/Date/index.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
|
||||
export const defaultText = 'default-text';
|
||||
|
||||
const DateFields: CollectionConfig = {
|
||||
slug: 'date-fields',
|
||||
admin: {
|
||||
useAsTitle: 'date',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'default',
|
||||
type: 'date',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'timeOnly',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'timeOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'dayOnly',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'dayOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'dayAndTime',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'dayAndTime',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'monthOnly',
|
||||
type: 'date',
|
||||
admin: {
|
||||
date: {
|
||||
pickerAppearance: 'monthOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const dateDoc = {
|
||||
default: '2022-08-12T10:00:00.000+00:00',
|
||||
timeOnly: '2022-08-12T10:00:00.157+00:00',
|
||||
dayOnly: '2022-08-11T22:00:00.000+00:00',
|
||||
dayAndTime: '2022-08-12T10:00:00.052+00:00',
|
||||
monthOnly: '2022-07-31T22:00:00.000+00:00',
|
||||
};
|
||||
|
||||
export default DateFields;
|
||||
@@ -6,6 +6,7 @@ import ArrayFields, { arrayDoc } from './collections/Array';
|
||||
import BlockFields, { blocksDoc } from './collections/Blocks';
|
||||
import CollapsibleFields, { collapsibleDoc } from './collections/Collapsible';
|
||||
import ConditionalLogic, { conditionalLogicDoc } from './collections/ConditionalLogic';
|
||||
import DateFields, { dateDoc } from './collections/Date';
|
||||
import RichTextFields, { richTextDoc } from './collections/RichText';
|
||||
import SelectFields, { selectsDoc } from './collections/Select';
|
||||
import TabsFields, { tabsDoc } from './collections/Tabs';
|
||||
@@ -44,6 +45,7 @@ export default buildConfig({
|
||||
NumberFields,
|
||||
Uploads,
|
||||
IndexedFields,
|
||||
DateFields,
|
||||
],
|
||||
localization: {
|
||||
defaultLocale: 'en',
|
||||
@@ -66,6 +68,7 @@ export default buildConfig({
|
||||
await payload.create({ collection: 'select-fields', data: selectsDoc });
|
||||
await payload.create({ collection: 'tabs-fields', data: tabsDoc });
|
||||
await payload.create({ collection: 'point-fields', data: pointDoc });
|
||||
await payload.create({ collection: 'date-fields', data: dateDoc });
|
||||
|
||||
const createdTextDoc = await payload.create({ collection: 'text-fields', data: textDoc });
|
||||
|
||||
|
||||
@@ -295,6 +295,20 @@ export interface IndexedField {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "date-fields".
|
||||
*/
|
||||
export interface DateField {
|
||||
id: string;
|
||||
default: string;
|
||||
timeOnly?: string;
|
||||
dayOnly?: string;
|
||||
dayAndTime?: string;
|
||||
monthOnly?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
|
||||
Reference in New Issue
Block a user