DEV Community

Discussion on: Clever code

Collapse
 
rhymes profile image
rhymes • Edited

Not "clever code" but "clever design".

I'm at present working with an API that returns times (not datetimes, just the hours part) in this format:

{"open": "08:20:00", "close": "300"}

I asked about the meaning of "300" to the developers that wrote the API and the answer they gave me is: well, we compute the closing hour with this PHP algorithm:

date('H:i', strtotime('08:20:00') + (300*60))
# result is "13:20"

So, instead of writing the actual closing time, they decided to do this, in a REST API.

I wanted to scream :-D

Now I have to figure out how to implement the same thing in Python -_-

Collapse
 
bertilmuth profile image
Bertil Muth

Good luck ;)

Collapse
 
knth profile image
KNTH

I wanted to scream too by reading this!

Collapse
 
patoezequiel profile image
Patricio Hondagneu Roig

I feel your pain.

Literally, I shuddered after reading that.