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

Fix issues with adding/subtracting durations from Dayjs objects #1156

Merged
merged 5 commits into from
Oct 21, 2020

Conversation

mfogel
Copy link
Contributor

@mfogel mfogel commented Oct 20, 2020

In #1099 support was added for passing in a duration object to add() or subtract(), which is awesome. I ran across a few issues when using it. This PR:

Also missing are docs for this feature, though that looks like that should be done in the website repo so not included in this PR.

Thanks a ton for dayjs!

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #1156 into dev will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev     #1156   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          174       174           
  Lines         1632      1634    +2     
  Branches       368       369    +1     
=========================================
+ Hits          1632      1634    +2     
Impacted Files Coverage Δ
src/plugin/duration/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab13754...d3e94af. Read the comment docs.

@mfogel mfogel force-pushed the fix/typings-add-subtract-durations branch from 9868167 to 379f348 Compare October 21, 2020 11:15
@mfogel
Copy link
Contributor Author

mfogel commented Oct 21, 2020

@iamkun thanks for catching that

I also pushed another commit to this PR: the typescript typings for add() and subtract() show the unit arg as required, which as you pointed out, it isn't.

That commit introduced some merge conflicts with work that's been merged to dev recently, so I also rebased on the latest on dev.

Let me know if you see anything else to fix/change or whatnot, thank you.

types/index.d.ts Outdated Show resolved Hide resolved
@iamkun iamkun merged commit f861aca into iamkun:dev Oct 21, 2020
iamkun pushed a commit that referenced this pull request Oct 23, 2020
## [1.9.4](v1.9.3...v1.9.4) (2020-10-23)

### Bug Fixes

* Add descriptions to types ([#1148](#1148)) ([9a407a1](9a407a1))
* add devHelper plugin ([#1163](#1163)) ([de49dc8](de49dc8))
* Fix Hungarian (hu) locale ([#1112](#1112)) ([ab13754](ab13754))
* fix minMax plugin parsing empty array bug ([#1062](#1062)) ([368108b](368108b))
* update adding/subtracting Duration from Dayjs object ([#1156](#1156)) ([f861aca](f861aca))
* update en-NZ locale to use proper ordinal formatting function ([#1143](#1143)) ([fcdbc58](fcdbc58))
* update localeData plugin type ([#1116](#1116)) ([ee5a4ec](ee5a4ec))
* update timezone plugin to support custom parse format ([#1160](#1160)) ([48cbf31](48cbf31)), closes [#1159](#1159)
* update timezone plugin to support keepLocalTime ([#1161](#1161)) ([1d429e5](1d429e5)), closes [#1149](#1149)
@iamkun
Copy link
Owner

iamkun commented Oct 23, 2020

🎉 This PR is included in version 1.9.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this pull request May 10, 2022
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23)

### Bug Fixes

* Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1))
* add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8))
* Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754))
* fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b))
* update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca))
* update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58))
* update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec))
* update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159)
* update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this pull request May 10, 2022
## [1.9.4](iamkun/dayjs@v1.9.3...v1.9.4) (2020-10-23)

### Bug Fixes

* Add descriptions to types ([#1148](iamkun/dayjs#1148)) ([9a407a1](iamkun/dayjs@9a407a1))
* add devHelper plugin ([#1163](iamkun/dayjs#1163)) ([de49dc8](iamkun/dayjs@de49dc8))
* Fix Hungarian (hu) locale ([#1112](iamkun/dayjs#1112)) ([ab13754](iamkun/dayjs@ab13754))
* fix minMax plugin parsing empty array bug ([#1062](iamkun/dayjs#1062)) ([368108b](iamkun/dayjs@368108b))
* update adding/subtracting Duration from Dayjs object ([#1156](iamkun/dayjs#1156)) ([f861aca](iamkun/dayjs@f861aca))
* update en-NZ locale to use proper ordinal formatting function ([#1143](iamkun/dayjs#1143)) ([fcdbc58](iamkun/dayjs@fcdbc58))
* update localeData plugin type ([#1116](iamkun/dayjs#1116)) ([ee5a4ec](iamkun/dayjs@ee5a4ec))
* update timezone plugin to support custom parse format ([#1160](iamkun/dayjs#1160)) ([48cbf31](iamkun/dayjs@48cbf31)), closes [#1159](iamkun/dayjs#1159)
* update timezone plugin to support keepLocalTime ([#1161](iamkun/dayjs#1161)) ([1d429e5](iamkun/dayjs@1d429e5)), closes [#1149](iamkun/dayjs#1149)
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 this pull request may close these issues.

2 participants