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

Array format support is not reflected in the type definition for typescript #944

Closed
crhg opened this issue Jun 30, 2020 · 4 comments · Fixed by #945
Closed

Array format support is not reflected in the type definition for typescript #944

crhg opened this issue Jun 30, 2020 · 4 comments · Fixed by #945
Labels

Comments

@crhg
Copy link

crhg commented Jun 30, 2020

Describe the bug
Array format is supported by #906, but typescript gives the following type error.

dayjs('2020-02-02', ['YYYY', 'YYYY-DD-MM'])
 error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'string | { locale?: string | undefined; format?: string | undefined; utc?: boolean | undefined; } | undefined'.
      Type 'string[]' is not assignable to type 'string'.

I think we need to update the function signature for typescript.

Expected behavior
It works just as well as javascript

Information

  • Day.js Version : 1.8.28
  • OS: macOS
@iamkun
Copy link
Owner

iamkun commented Jun 30, 2020

Updated, thanks.

iamkun pushed a commit that referenced this issue Jul 2, 2020
## [1.8.29](v1.8.28...v1.8.29) (2020-07-02)

### Bug Fixes

* Duration plugin supports parse ISO string with week (W) ([#950](#950)) ([f0fc12a](f0fc12a))
* LocaleData plugin supports locale order ([#938](#938)) ([62f429d](62f429d)), closes [#936](#936)
* Update type definition to support array format ([#945](#945)) ([81d4740](81d4740)), closes [#944](#944)
* Update type definition to support strict mode ([#951](#951)) ([8d54f3f](8d54f3f))
@iamkun
Copy link
Owner

iamkun commented Jul 2, 2020

🎉 This issue has been resolved in version 1.8.29 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamkun iamkun added the released label Jul 2, 2020
@sziraqui
Copy link

sziraqui commented Oct 8, 2020

Same issue on dayjs.utc()

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.8.29](iamkun/dayjs@v1.8.28...v1.8.29) (2020-07-02)

### Bug Fixes

* Duration plugin supports parse ISO string with week (W) ([#950](iamkun/dayjs#950)) ([f0fc12a](iamkun/dayjs@f0fc12a))
* LocaleData plugin supports locale order ([#938](iamkun/dayjs#938)) ([62f429d](iamkun/dayjs@62f429d)), closes [#936](iamkun/dayjs#936)
* Update type definition to support array format ([#945](iamkun/dayjs#945)) ([81d4740](iamkun/dayjs@81d4740)), closes [#944](iamkun/dayjs#944)
* Update type definition to support strict mode ([#951](iamkun/dayjs#951)) ([8d54f3f](iamkun/dayjs@8d54f3f))
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.8.29](iamkun/dayjs@v1.8.28...v1.8.29) (2020-07-02)

### Bug Fixes

* Duration plugin supports parse ISO string with week (W) ([#950](iamkun/dayjs#950)) ([f0fc12a](iamkun/dayjs@f0fc12a))
* LocaleData plugin supports locale order ([#938](iamkun/dayjs#938)) ([62f429d](iamkun/dayjs@62f429d)), closes [#936](iamkun/dayjs#936)
* Update type definition to support array format ([#945](iamkun/dayjs#945)) ([81d4740](iamkun/dayjs@81d4740)), closes [#944](iamkun/dayjs#944)
* Update type definition to support strict mode ([#951](iamkun/dayjs#951)) ([8d54f3f](iamkun/dayjs@8d54f3f))
@RaymondMwaura
Copy link

Still unresolved:

dayjs(dataItem[dateField], "DD-MM-YYYY");

allmoviestvshowslistsfilmography28 added a commit to allmoviestvshowslistsfilmography28/dayjs that referenced this issue Sep 12, 2024
## [1.8.29](iamkun/dayjs@v1.8.28...v1.8.29) (2020-07-02)

### Bug Fixes

* Duration plugin supports parse ISO string with week (W) ([#950](iamkun/dayjs#950)) ([0472455](iamkun/dayjs@0472455))
* LocaleData plugin supports locale order ([#938](iamkun/dayjs#938)) ([e244af4](iamkun/dayjs@e244af4)), closes [#936](iamkun/dayjs#936)
* Update type definition to support array format ([#945](iamkun/dayjs#945)) ([eb50029](iamkun/dayjs@eb50029)), closes [#944](iamkun/dayjs#944)
* Update type definition to support strict mode ([#951](iamkun/dayjs#951)) ([86f72a9](iamkun/dayjs@86f72a9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants