mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat(a11y): improve voiceover a11y for datetime component
Remove formatDatetime function. Created a JSX function component (FormattedDatetime) inside Datetime component. This component returns formatted date and time with better voiceover enhancements.
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
const formatDatetime = (datetime: string) => {
|
||||
const myDatetime = new Date(datetime);
|
||||
return (
|
||||
myDatetime.toLocaleDateString([], {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
}) +
|
||||
" | " +
|
||||
myDatetime.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
|
||||
);
|
||||
};
|
||||
|
||||
export default formatDatetime;
|
||||
Reference in New Issue
Block a user