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

Add option callback to calendar plugin #839

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

edumoreira1506
Copy link
Contributor

This PR resolves issue #806

Now the second param of dayjs().calendar(...) can be an object of callbacks, and the old behavior with a simples object of strings is working too!

I added some tests too for test this new feature. Hope that helps!

@codecov
Copy link

codecov bot commented Mar 17, 2020

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##               dev      #839   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          157       158    +1     
  Lines         1148      1195   +47     
  Branches       216       243   +27     
=========================================
+ Hits          1148      1195   +47     
Impacted Files Coverage Δ
src/plugin/calendar/index.js 100.00% <100.00%> (ø)
src/locale/cs.js 100.00% <0.00%> (ø)
src/locale/sk.js 100.00% <0.00%> (ø)
src/locale/uk.js 100.00% <0.00%> (ø)
src/locale/zh.js 100.00% <0.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 193cf4b...fa29548. Read the comment docs.

@iamkun
Copy link
Owner

iamkun commented Mar 18, 2020

Thanks.

Plus, I'd like to keep the callback the same as moment.js. Could you please add more test to test it's callback is a function with the scope of the current moment and first argument a moment that depicts now

Cheers.

@edumoreira1506 edumoreira1506 force-pushed the feature/calendar-callback branch 2 times, most recently from 9ec5dad to 1e9ee26 Compare March 19, 2020 12:32
@iamkun
Copy link
Owner

iamkun commented Mar 19, 2020

test failed
Screen Shot 2020-03-20 at 12 25 22 AM

@edumoreira1506
Copy link
Contributor Author

Fixed @iamkun !

@iamkun iamkun merged commit b25be90 into iamkun:dev Mar 24, 2020
@iamkun
Copy link
Owner

iamkun commented Mar 24, 2020

THX

iamkun pushed a commit that referenced this pull request Apr 10, 2020
## [1.8.24](v1.8.23...v1.8.24) (2020-04-10)

### Bug Fixes

* Add config option to RelativeTime plugin ([#851](#851)) ([bd24034](bd24034))
* add Duration plugin ([#858](#858)) ([d568273](d568273))
* Add en-in, en-tt locales ([#855](#855)) ([c39fb96](c39fb96))
* add isToday, isTomorrow, isYesterday plugins ([#857](#857)) ([fc08ab6](fc08ab6))
* Add option callback to Calendar plugin ([#839](#839)) ([b25be90](b25be90))
* Fix monthsShort for locale fr ([#862](#862)) ([d2de9a0](d2de9a0))
* Update Breton locale (br) meridiem config ([#856](#856)) ([a2a6672](a2a6672))
* Update Ukrainian (uk) locale relative time ([#842](#842)) ([578bc1a](578bc1a))
@iamkun
Copy link
Owner

iamkun commented Apr 10, 2020

🎉 This PR is included in version 1.8.24 🎉

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.8.24](iamkun/dayjs@v1.8.23...v1.8.24) (2020-04-10)

### Bug Fixes

* Add config option to RelativeTime plugin ([#851](iamkun/dayjs#851)) ([bd24034](iamkun/dayjs@bd24034))
* add Duration plugin ([#858](iamkun/dayjs#858)) ([d568273](iamkun/dayjs@d568273))
* Add en-in, en-tt locales ([#855](iamkun/dayjs#855)) ([c39fb96](iamkun/dayjs@c39fb96))
* add isToday, isTomorrow, isYesterday plugins ([#857](iamkun/dayjs#857)) ([fc08ab6](iamkun/dayjs@fc08ab6))
* Add option callback to Calendar plugin ([#839](iamkun/dayjs#839)) ([b25be90](iamkun/dayjs@b25be90))
* Fix monthsShort for locale fr ([#862](iamkun/dayjs#862)) ([d2de9a0](iamkun/dayjs@d2de9a0))
* Update Breton locale (br) meridiem config ([#856](iamkun/dayjs#856)) ([a2a6672](iamkun/dayjs@a2a6672))
* Update Ukrainian (uk) locale relative time ([#842](iamkun/dayjs#842)) ([578bc1a](iamkun/dayjs@578bc1a))
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this pull request May 10, 2022
## [1.8.24](iamkun/dayjs@v1.8.23...v1.8.24) (2020-04-10)

### Bug Fixes

* Add config option to RelativeTime plugin ([#851](iamkun/dayjs#851)) ([bd24034](iamkun/dayjs@bd24034))
* add Duration plugin ([#858](iamkun/dayjs#858)) ([d568273](iamkun/dayjs@d568273))
* Add en-in, en-tt locales ([#855](iamkun/dayjs#855)) ([c39fb96](iamkun/dayjs@c39fb96))
* add isToday, isTomorrow, isYesterday plugins ([#857](iamkun/dayjs#857)) ([fc08ab6](iamkun/dayjs@fc08ab6))
* Add option callback to Calendar plugin ([#839](iamkun/dayjs#839)) ([b25be90](iamkun/dayjs@b25be90))
* Fix monthsShort for locale fr ([#862](iamkun/dayjs#862)) ([d2de9a0](iamkun/dayjs@d2de9a0))
* Update Breton locale (br) meridiem config ([#856](iamkun/dayjs#856)) ([a2a6672](iamkun/dayjs@a2a6672))
* Update Ukrainian (uk) locale relative time ([#842](iamkun/dayjs#842)) ([578bc1a](iamkun/dayjs@578bc1a))
allmoviestvshowslistsfilmography28 added a commit to allmoviestvshowslistsfilmography28/dayjs that referenced this pull request Sep 12, 2024
## [1.8.24](iamkun/dayjs@v1.8.23...v1.8.24) (2020-04-10)

### Bug Fixes

* Add config option to RelativeTime plugin ([#851](iamkun/dayjs#851)) ([9daecea](iamkun/dayjs@9daecea))
* add Duration plugin ([#858](iamkun/dayjs#858)) ([1e33e4b](iamkun/dayjs@1e33e4b))
* Add en-in, en-tt locales ([#855](iamkun/dayjs#855)) ([8c37690](iamkun/dayjs@8c37690))
* add isToday, isTomorrow, isYesterday plugins ([#857](iamkun/dayjs#857)) ([4b9f80e](iamkun/dayjs@4b9f80e))
* Add option callback to Calendar plugin ([#839](iamkun/dayjs#839)) ([3ffb86a](iamkun/dayjs@3ffb86a))
* Fix monthsShort for locale fr ([#862](iamkun/dayjs#862)) ([418525d](iamkun/dayjs@418525d))
* Update Breton locale (br) meridiem config ([#856](iamkun/dayjs#856)) ([a66e627](iamkun/dayjs@a66e627))
* Update Ukrainian (uk) locale relative time ([#842](iamkun/dayjs#842)) ([04733d6](iamkun/dayjs@04733d6))
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