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

".hooks" in not a known option #2601

Closed
aldak opened this issue Jul 7, 2022 · 3 comments
Closed

".hooks" in not a known option #2601

aldak opened this issue Jul 7, 2022 · 3 comments

Comments

@aldak
Copy link

aldak commented Jul 7, 2022

Hello, I'm trying to make own parse method using hooks.inputParse

const td = new tempusDominus.TempusDominus(collection[i],{
		display: { keepOpen: false},
		hooks: { 
			inputParse: (td, value) => {  
				alert(value);
				return new tempusDominus.DateTime(value);
			}
		}
	});

But I'm getting error
Uncaught Error: TD:: ".hooks" in not a known option. at ErrorMessages.unexpectedOptions (errors.ts:27:19) at OptionConverter.spread (optionConverter.ts:138:37) at OptionConverter._mergeOptions (optionConverter.ts:395:25) at TempusDominus._initializeOptions (tempus-dominus.ts:321:33) at new TempusDominus (tempus-dominus.ts:50:10) at hany_functions.js:47:13

@Eonasdan
Copy link
Owner

Eonasdan commented Jul 7, 2022

Hooks where removed in beta 4 in favor of plugins. Please see the change log and the momentjs plugin docs

@Eonasdan Eonasdan closed this as completed Jul 7, 2022
@aldak
Copy link
Author

aldak commented Jul 7, 2022

Thank you for answer.
But I have one more issue with this momentjs plugin, because I don't know how to configure it to parse more date formats. I have on one page more input fields with different formats (DD.MM.yyyy or DD.MM.yyyy HH:mm).
Could you advice me plz?

@Eonasdan
Copy link
Owner

Eonasdan commented Jul 9, 2022

there's a meta object on the config that you can set to whatever you want. At that point you could use this.optionsStore.options.meta.myFormat. You don't have to use moment, btw. You do or use whatever you want to format it.

You could get the format some other way as well. The momentjs plugin is an easy to adapt example.

There's also discussions on #2537 on expanding the date time object to support other formats.

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

No branches or pull requests

2 participants