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

feat: add plugin range #1580

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open

feat: add plugin range #1580

wants to merge 32 commits into from

Conversation

imwh0im
Copy link
Contributor

@imwh0im imwh0im commented Jul 16, 2021

@codecov
Copy link

codecov bot commented Jul 16, 2021

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (305f540) 99.77% compared to head (bd01fd9) 99.78%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1580   +/-   ##
=======================================
  Coverage   99.77%   99.78%           
=======================================
  Files         183      184    +1     
  Lines        2262     2289   +27     
  Branches      642      649    +7     
=======================================
+ Hits         2257     2284   +27     
  Misses          5        5           
Files Coverage Δ
src/plugin/range/index.js 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coatesap
Copy link

Would it be worth naming this 'Period' rather than 'Range'? I'm aware that Moment plugin was called 'range', but usually in programming languages, 'range' is used to generate a sequence of things, whereas this feature is about creating a date 'period'.

The Moment plugin covers the term 'range' by also being iterable, which this could implement.

I raise this, as #1162 asked for the ability to generate date ranges, and I've got a plugin in the works that would be called via dayjs.range(start, end, unit, options), so I wouldn't want to end up with a naming clash.

src/plugin/range/index.js Outdated Show resolved Hide resolved
@G-11-P
Copy link

G-11-P commented Nov 10, 2021

Passed

types/plugin/range.d.ts Outdated Show resolved Hide resolved
types/plugin/range.d.ts Outdated Show resolved Hide resolved
src/plugin/range/index.js Outdated Show resolved Hide resolved
imwh0im and others added 3 commits December 22, 2021 19:02
Co-authored-by: David <david@hmnd.io>
Co-authored-by: David <david@hmnd.io>
Co-authored-by: David <david@hmnd.io>
@imwh0im
Copy link
Contributor Author

imwh0im commented Dec 22, 2021

@hmnd Thanks your suggested

@imwh0im
Copy link
Contributor Author

imwh0im commented Feb 18, 2022

https://github.com/imwh0im/dayjs-range-extend

I've awaited #1580, and I can't wait no more.
So I've decided to implement the range function by myself.

range function module name is dayjs-range-extend, this Module make below things possible.

  • Support date range
  • Validation date range
  • Support TypeScript
  • Other functions..

i've mentioned, i couldn't wait anymore range function. However, want use range function from Day.js.
Unless there is a separate plan for the date range function, dayjs-range-extend is would be left.

@katerlouis
Copy link

@iamkun still no plans to merge this? :')

@nofacez
Copy link

nofacez commented Mar 30, 2022

Looking forward for this feature, so needed!

@eelior
Copy link

eelior commented Jun 13, 2022

Is this project still maintained @iamkun ?
Would love to see this PR merged 🙏

@oldschoolbg
Copy link

In the absence of this being merged I'm going to have to use @imwh0im plugin... I also second this as being really important to merge if at all possible - it's a really useful tool to have as I am just migrating away from Moment (finally) :)

@arielkuzminski
Copy link

What's going on with this PR?

@jBernavaPrah
Copy link

Any news?

@ceefour
Copy link

ceefour commented Mar 31, 2023

Agree with others... Please merge

@YokiToki
Copy link

dayjs.ranges(
    dayjs("2021-07-16"),
    dayjs("2023-07-24"),
    "days"
)

@vickyRathee
Copy link

When can we expect this to be merged?

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

Successfully merging this pull request may close these issues.

None yet