mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-03-01 01:40:42 +00:00
only attempting converting a date string if it looks like a date without year first w/ burnettk
This commit is contained in:
parent
7489d17f4f
commit
4f5a590e1e
@ -41,12 +41,11 @@ const convertDateObjectToFormattedString = (dateObject: Date) => {
|
||||
};
|
||||
|
||||
const dateStringToYMDFormat = (dateString: string) => {
|
||||
// if the date looks like it's already in yyyy-MM--dd format then just return it
|
||||
if (dateString.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
||||
return dateString;
|
||||
if (dateString && dateString.match(/^\d{2}-\d{2}-\d{4}$/)) {
|
||||
const newDate = parse(dateString, DATE_FORMAT, new Date());
|
||||
return format(newDate, 'yyyy-MM-dd');
|
||||
}
|
||||
const newDate = parse(dateString, DATE_FORMAT, new Date());
|
||||
return format(newDate, 'yyyy-MM-dd');
|
||||
return dateString;
|
||||
};
|
||||
|
||||
const convertDateAndTimeStringsToDate = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user