Another timestamp microservice

Another timestamp microservice
0

#1

Hi! I just finished my first backend project! Here’s my timestamp microservice which heroku named shrouded-oasis-48135. This is the github repo.


#2

If you check out the heroku docs you can rename it, other than that looking good :slight_smile:


#3

Thanks :slight_smile:. I was too lazy to come up with a name, though it’s good to know that you can rename it.


#4

Yeah, us lazy developers don’t have time for that :stuck_out_tongue:


#5

I tried Natural date February 29, 2015 and I got unexpected response :wink:


#6

I typed October 27 1989 and got totally unexpected response as well


#7

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.


#8

Have you considered using moment.js ? It will take care of the converter for you


#9

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?


#10

I tried natural date dkfjdkjfkdjf 0 and still got result :smiling_imp:

Same with f -5


#11

If only I’m not sleepy right now I’d fix it right away. Thanks for pointing this silly mistake out :slight_smile:

Quick follow-up: the example timestamp has this bug too


#12

Sorry, my mistake. I meant that if you type October271989 without the space, I get weird response


#13

Yep, that’s weird alright. Thanks for the feedback :slight_smile:


#14

There, I believe I’ve fixed those issues. :slight_smile:


#15

I typed the same date, and now I get null instead


#16

I guess we can leave it at that :thinking:. It’s better than returning a really weird value


#17

Don’t give up! You’re really close. Take a look at Moment.Js. Once you understand how that works, it will simply everything


#18

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).