Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: dayjs() as composable #57

Open
KillerJulian opened this issue Oct 3, 2024 · 1 comment · May be fixed by #58
Open

[FEAT]: dayjs() as composable #57

KillerJulian opened this issue Oct 3, 2024 · 1 comment · May be fixed by #58

Comments

@KillerJulian
Copy link

KillerJulian commented Oct 3, 2024

Current

useDayjs()() is an ugly code style in my opinion!

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'));

Feature 🚀

dayjs() as autoimport!

console.log(dayjs().format('YYYY-MM-DD HH:mm:ss'));

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:

export function dayjs(...args: Parameters<ReturnType<typeof useDayjs>>) {
	return useDayjs()(...args);
}

~/composables/dayjs.ts

@acidjazz
Copy link
Member

acidjazz commented Oct 7, 2024

Very cool suggestion, feel free to start a PR!

@KillerJulian KillerJulian linked a pull request Oct 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants