Closed Evertt closed 8 years ago
@Evertt Thank you for a cool suggestion! I think 9.45.AM
represents a Date
instance rather than a DateComponents
instance. What do you think?
I 100% disagree. When I write let time = 9.45.AM
, I have not defined on which day, because I'm not talking about any specific day, I'm just talking about a specific time.
To give you a use case example. I might want to write a task schedular which performs a certain task every day at a certain time:
let task = DoSomething()
taskManager.schedule(task, dailyAt: 9.45.AM)
// or
taskManager.schedule(task, weeklyOn: [.monday, .friday], at: 9.45.AM)
Now if 9.45.AM
produced a Date then that would be very confusing for that function, do you see?
By the way, I already implemented this in a PR (#70) and the way I did it now, if you want to add specific date-information you can do something like this:
let queueUntil = 1.week.from(.now)!.at(9.30.AM)
The optional is only there because you guys use optionals so I did it too. I would personally prefer to not have it as an optional.
I see. 9.45.AM
means DateComponents(hour: 9, minute: 45)
, isn't it?
exactly
You know what I'd find cool? To be able to write this:
And have the correct DateComponents.