florianv / business

:date: DateTime calculations in business hours
http://florianv.github.io/business
MIT License
361 stars 25 forks source link

Get closest closing time #24

Open saymon92 opened 7 years ago

saymon92 commented 7 years ago

Hi. Thanks for your work.

Is possible to get the closest closing time from a given date? For example Days::MONDAY, [['08:00', '13:00'], ['14:00', '18:30']] i need a function like $business->closestClosing(new \DateTime('2017-07-24 10:00')); return '13:00'.

thanks

florianv commented 7 years ago

Hey,

Maybe you can maybe do this ?

$lastDate = $business->closest(new \DateTime('2017-07-24 10:00'), Business::CLOSEST_LAST);
vinespie commented 6 years ago

Hi @florianv ,

Business::CLOSEST_LAST mode parameter do not work with closest method. In the cas above, return date "2017-07-24 10:00:00.000000" instead of "2017-07-24 13:00:00.000000"

Thanks

agencefacton commented 5 years ago

No response for this problem, I have the same question...

I have the open days and special days, the holidays by day, but I want to closed the day for 2 hours, it's not possible actually... ?!?!

Please help.

agencefacton commented 5 years ago

?!