Skip to content

Commit 61e8bf0

Browse files
committed
Replace YYYY-MM-DD by the constant DATE_FORMAT
1 parent 82790be commit 61e8bf0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/Input.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const Input: React.FC<Props> = (e: Props) => {
5353

5454
const border = BORDER_COLOR.focus[primaryColor as keyof typeof BORDER_COLOR.focus];
5555
const ring =
56-
RING_COLOR["second-focus"][primaryColor as keyof typeof RING_COLOR["second-focus"]];
56+
RING_COLOR["second-focus"][primaryColor as keyof (typeof RING_COLOR)["second-focus"]];
5757

5858
const defaultInputClassName = `relative transition-all duration-300 py-2.5 pl-4 pr-14 w-full border-gray-300 dark:bg-slate-800 dark:text-white/80 dark:border-slate-600 rounded-lg tracking-wide font-light text-sm placeholder-gray-400 bg-white focus:ring disabled:opacity-40 disabled:cursor-not-allowed ${border} ${ring}`;
5959

@@ -69,12 +69,12 @@ const Input: React.FC<Props> = (e: Props) => {
6969
const inputValue = e.target.value;
7070

7171
const start = parseFormattedDate(inputValue.slice(0, 10), displayFormat).format(
72-
"YYYY-MM-DD"
72+
DATE_FORMAT
7373
);
7474
const end = asSingle
7575
? start
7676
: parseFormattedDate(inputValue.slice(11, inputValue.length), displayFormat).format(
77-
"YYYY-MM-DD"
77+
DATE_FORMAT
7878
);
7979

8080
const input = inputRef?.current;

src/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function formatDate(date: dayjs.Dayjs, format = DATE_FORMAT) {
7373
return date.format(format);
7474
}
7575

76-
export function parseFormattedDate(date: string, format = "YYYY-MM-DD") {
76+
export function parseFormattedDate(date: string, format = DATE_FORMAT) {
7777
return dayjs(date, format);
7878
}
7979

0 commit comments

Comments
 (0)