Open KillerJulian opened 5 days ago
useDayjs()() is an ugly code style in my opinion!
useDayjs()()
console.log(useDayjs()().format('YYYY-MM-DD HH:mm:ss')); // or two lines const dayjs = useDayjs(); console.log(dayjs().format('YYYY-MM-DD HH:mm:ss'));
dayjs() as autoimport!
dayjs()
console.log(dayjs().format('YYYY-MM-DD HH:mm:ss'));
This can certainly be solved more beautifully in the library, but until the feature is available in the library, it can be used as a composable:
export function dayjs(...args: Parameters<ReturnType<typeof useDayjs>>) { return useDayjs()(...args); }
~/composables/dayjs.ts
Very cool suggestion, feel free to start a PR!
Current
useDayjs()()
is an ugly code style in my opinion!Feature 🚀
dayjs()
as autoimport!Workarround
This can certainly be solved more beautifully in the library, but until the feature is available in the library, it can be used as a composable:
~/composables/dayjs.ts