Closed
Description
Steps to reproduce
iex(2)> date = ~D[2023-03-31]
~D[2023-03-31]
iex(3)> time = ~N[2023-04-03 13:30:00]
~N[2023-04-03 13:30:00]
iex(4)> Timex.set(time, day: date.day, month: date.month, year: date.year)
~N[2023-03-30 13:30:00]
iex(5)> Timex.set(time, month: date.month, year: date.year, day: date.day)
~N[2023-03-31 13:30:00]
iex(10)> Timex.set(time, date: {date.year, date.month, date.day})
[date: {2023, 3, 31}]
Description of issue
- What are the expected results?
The order of argument put intoset/2
matters sinceTimex.set(time, day: date.day, month: date.month, year: date.year)
will not always produce the same result asTimex.set(time, month: date.month, year: date.year, day: date.day)
Technically the user could/should have used the date
option but this may not always be obvious.
I kinda propose to either pre parse the options to convert month
, year
& day
options into a single date
option or sort the options list by importance such that year is being set first, month second and day third (in our example).
What are you thinking?
Would happily work on this! :)
Metadata
Metadata
Assignees
Labels
No labels