Hi! I just finished my first backend project! Here’s my timestamp microservice which heroku named shrouded-oasis-48135. This is the github repo.
If you check out the heroku docs you can rename it, other than that looking good
Thanks . I was too lazy to come up with a name, though it’s good to know that you can rename it.
Yeah, us lazy developers don’t have time for that
I tried Natural date February 29, 2015
and I got unexpected response
I typed October 27 1989
and got totally unexpected response as well
Oh my… Damn corner cases! Not only that, it seems it will accept a date as long as the day doesn’t exceed 31, so it happily accepts February 31.
Have you considered using moment.js ? It will take care of the converter for you
I guess I’ll check it out. Dates are darn tricky.
I don’t see what’s wrong with October 27 1989. I tried it with another timestamp and it gave the same results. Can you explain what’s wrong?
I tried natural date dkfjdkjfkdjf 0
and still got result
Same with f -5
If only I’m not sleepy right now I’d fix it right away. Thanks for pointing this silly mistake out
Quick follow-up: the example timestamp has this bug too
Sorry, my mistake. I meant that if you type October271989
without the space, I get weird response
Yep, that’s weird alright. Thanks for the feedback
There, I believe I’ve fixed those issues.
I typed the same date, and now I get null
instead
I guess we can leave it at that . It’s better than returning a really weird value
Don’t give up! You’re really close. Take a look at Moment.Js. Once you understand how that works, it will simply everything
I’m actually using it, and I kind of settled with not allowing inputs with no spaces in between. I’m parsing dates in strict mode, so I explicitly listed formats that I allow. If I used nonstrict mode, I’d probably have to write my own parsing rules, since nonstrict mode is a bit too lax (for example, on 'X'
format, it parses '4 Nov'
and gives a date with unix: 4
).