Elixir: Add Date.range

Created on 13 Jun 2017  路  5Comments  路  Source: elixir-lang/elixir

It should use a Date.Range struct that implements the Enumerable protocol. It should keep the first and last dates for member? tests and the first_rata_die and last_rata_die for a fast reduce implementation and a kind field that describes it as increasing or decreasing. The range dates must have matching calendars.

Elixir Enhancement Intermediate

Most helpful comment

@jameslong I already have a working prototype :) some polishing left to do but shouldn't take long. Thanks for offering!

All 5 comments

Hi!

What would the interface for this be? I guess Date.Range.new(first_date, last_date) should do it.
Also, with the range dates must have matching calendars you mean that they should be one of: Date, Time, NaiveDateTime and DateTime, or am I missing something?

Nice one, i like it! :)

The interface is Date.range/2. Matching calendars mean the calendar field in the data struct received as argument must match.

If you're okay with it, I'd like to see if I can take care of this. It's a little bit more complex than what I've done so far but I think I can tackle it :)

Thanks!

@uesteibar If you don't have time please let me know because I can have a crack at it this weekend.

@jameslong I already have a working prototype :) some polishing left to do but shouldn't take long. Thanks for offering!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

coryodaniel picture coryodaniel  路  3Comments

andrewcottage picture andrewcottage  路  3Comments

Paddy3118 picture Paddy3118  路  3Comments

josevalim picture josevalim  路  3Comments

whitepaperclip picture whitepaperclip  路  3Comments