Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.16k stars 4.41k forks source link

Typescript interface Options differs from Docs #2895

Closed martnst closed 5 months ago

martnst commented 5 months ago

Prerequisites

Describe the issue

I noticed that the Typescript interface Options differs from the docs.

For example: restrictions?.minDate is defined as optional DateTime in the see https://github.com/Eonasdan/tempus-dominus/blob/5da648d6cd5a469e111ac74ba4d259b6b5b9ab04/src/js/utilities/options.ts#L53

The docs however states:

Accepts: string | Date | DateTime Defaults: undefined

This results in a TS error when using the lib.

StackBlitz fork

https://stackblitz.com/edit/tempus-dominus-v6-repl-vkqxv8?file=example.ts

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of are you using? You can find this information from the sample StackBlitz.

v6

What your browser's locale? You can find this information from the sample StackBlitz.

en-*

Eonasdan commented 5 months ago

Once the JS is built, it does accept those value types, since a string is the most likely value type coming from plain JS. If you're using TS, then you should use the DateTime type.