/t/ - Science/Technology

For discussion of Science, Technology and Math

Loading...

[Return] [Go to Bottom] [Catalog]

File: logincode.png (41.17 KB, 977x548, 977:548, 1630078958699.png) [Show in Hex Viewer] [Reverse Image search]

 No.536[D]

Have you ever worked on a website?
Discuss anything webdev related. Dynamic sites, static, all welcome

 No.537[D][DF]

>>536
Pic related is a piece of the project I'm currently working on. It's for my university, and it consists of a simple auction web site I'm writing with java servlets + tomcat server + mysql + thymeleaf (a templating engine)
I have to say that it's pretty interesting. It turned out surprisingly time-consuming to write, but I'm getting there... Oh and I'm extremely lucky good looks aren't a requirement, because I'm helpless at that
By the way, I wrote it following the architecture they explained to us during the course, but I never ran the code till it was entirely finished. And that's scary. Don't do it, I don't recommend it

 No.539[D][DF]

>>536
Op here, just wanted to say that I hate dates to death.
In java (my backend language) there are 3 different built-in time libraries/types (For exact moments: java.sql.timestamp, java.util.Date, java.time.Instant)
But in case that wasn't enough, the most recent and recommended module, java.time, has a fuckton of different types of close meaning
>java.time.Instant - an instant in time
>java.time.ZonedDateTime - Also an instant, this time with timezone information
>java.time.LocalDateTime - Generic date and time, NOT a definite moment (depends on timezone, which is not stored)
>java.time.ZoneOffset - Literally a timezone offset. Not a timezone though! A single timezone can have two offsets due to dst
>java.time.ZoneID - This here is the Timezone
At this point I had gotten what I needed and thought my trials with dates were over. But then came javascript
It has just one type, Date, however it sucks fucking ass. All I want is for my application to assume "CET" timezone when reading and printing dates/times. Well, javascript's Date type doesn't have timezone info, instead that is used when printing/reading the date. Fine. But definitively it'll be easy to do that, right?
Well, JS just assumes your browser knows what's best, and if your browser has the wrong timezone setting... well suck a dick. And firefox browsers have wrong setting on purpose to fight trackers. Am I fucked? Well, there is a built-in library called "Intl" that allows for the programmer to work with timezones, but then older browsers go out the window. IE for example doesn't support jack shit. Why does this have to be so hard? Do I really need to plug in some third party "moment.js" library or implement timezone functionality myself?
Course not, fuck IE

 No.540[D][DF]

>>539
Small update: Intl is nothing more than a pretty print library. It's not actually usable for anything but printing stuff to the user.
I'll be implementing DST logic myself, thanks for sucking cocks javascript



[Reply to this Thread]

[Return] [Go to top] [Catalog]
[Post a Reply]