chore: updates dateTimeFormat

This commit is contained in:
Jessica Boezwinkle
2023-02-07 17:42:56 +00:00
parent 43e9c32ec6
commit 3bc67e338b

View File

@@ -23,7 +23,7 @@ const DateTime: React.FC<Props> = (props) => {
value,
onChange,
displayFormat,
pickerAppearance = 'dayAndTime',
pickerAppearance,
minDate,
maxDate,
monthsToShow = 1,
@@ -47,10 +47,11 @@ const DateTime: React.FC<Props> = (props) => {
let dateTimeFormat = displayFormat;
if (dateTimeFormat === undefined) {
if (dateTimeFormat === undefined && pickerAppearance) {
if (pickerAppearance === 'dayAndTime') dateTimeFormat = 'MMM d, yyy h:mm a';
else if (pickerAppearance === 'timeOnly') dateTimeFormat = 'h:mm a';
else if (pickerAppearance === 'monthOnly') dateTimeFormat = 'MM/yyyy';
else if (pickerAppearance === 'dayOnly') dateTimeFormat = 'dd';
else if (pickerAppearance === 'monthOnly') dateTimeFormat = 'MMMM';
else dateTimeFormat = 'MMM d, yyy';
}