Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "day light savings"
-
I lose all respect for people trying to schedule meetings with me when they write the time zone initialism incorrectly.
It is well into EDT. EST technically means you want to meet an hour earlier and that you live in a different time zone than everyone else on the east coast of the United States. But I'm just going to assume that you don't remember that really annoying daylight savings time shit we have to do twice a year and show up in EDT. -
The datepicker saga
Part one
So I begin work on a page where user add their details, project is late, taking ages on this page
Nearly done, just need a component to allow users to put in some date of births. Look for react components.
Avoiding that one because fuck Bootstrap.
Ah-ha, that looks good, let's give it a go.
CSS doesn't exist, oh need copy it over from npm dist. Great it applied but...
... WTF it's tiny. Thought it was a problem with my zoom. Nope found the issue in github.com and it's something to do with using REM rather than EM or something, okay someone provided a solution, rather I saw a couple of solutions, after some hacking around I got it working and pasted it in the right location and yes, it's a reasonable size now.
Only it's a bit crap because it only allows scrolling 1 month at a time. No good. Hunting through the docs reveals several options to add year and month drop downs and allow them to be scrolled. Still a bit shit as it only shows certain years, figure I'd set the start date position somewhere at the average.
Wait. The up button on the scroll doesn't even show, it's just a blank 5px button. Mouse scroll doesn't work
Fucking...
... Bailing on that.
Part 2
Okay sod it I'll just make my own three drop down select boxes, day, month and year. Easy.
At this point I take full responsibility and cannot blame any third party. And kids, take this as a lesson to plan out your code fully and make no assumptions on the simplicity of the problem.
For some reason (of which I regretted much) I decided to abstract things so much I made an array of three objects for each drop down. Containing the information to pretty much abstract away the field it was dealing with. This sort of meta programming really screwed with my head, I have lines like the following:
[...].map(optionGroup =>
optionGroup.options[
parseInt(
newState[optionGroup.momentId]
, 10)
]
)...
But I was in too deep and had to weave my way through this kind of abstract process like an intrepid explorer chopping through a rain forest with a butter knife.
So I am using React and Redux, decided it was overkill to use Redux to control each field. Only trouble is of course when the user clicks one of the fields, it doesn't make sense in redux to have one of the three fields selected. And I wanted to show the field title as the first option. So I went against good practice and used state to keep track of the fields before they are handed off to the parent/redux. What a nightmare that was.
Possibly the most challenging part was matching my indices with moment.js to get the UI working right, it was such a meta mess when it just shouldn't have taken so stupidly long.
But, I begin to see the light at the end of this tunnel, it's slowly coming together. And when it all clicks into place I sit back and actually quite enjoy my abysmal attempt at clean and easy to read code.
Part 3
Ran the generated timestamp through a converter and I get the day before, oh yeah that's great
Seems like it's dependant on the timezone??!
Nope. Deploying. Bye. I no longer care if daylight savings makes you a day younger.1