Coding Blocks - The Second Date is Always Easier

Episode Date: April 1, 2019

The Date deep dive continues as we focus in on C# and JavaScript, while Michael reminisces about the fluorescent crayons, Joe needs a new tip of the week, and Allen confuses time zones....

Transcript
Discussion (0)
Starting point is 00:00:01 You're listening to Coding Blocks, episode 103. Subscribe to us and leave us a review on iTunes, Spotify, Stitcher, and more using your favorite podcast app. And check us out at codingblocks.net where you can find show notes, examples, discussion, and a bunch of other things. Send your feedback, questions, and rants to comments at codingblocks.net. Follow us on Twitter at Coding Blocks or head to www.codingblocks.net and find all our social links there at the top of the page with that.
Starting point is 00:00:28 I'm Alan Underwood. I'm Joe Zach. And check us out. I'm Michael Outlaw. This episode is sponsored by data dog, a monitoring platform for cloud scale infrastructure and applications. Data dog provides dashboarding, alerting application application performance monitoring,
Starting point is 00:00:46 and log management in one tightly integrated platform so you can get end-to-end visibility quickly. You can visualize key metrics, set alerts to identify anomalies, and collaborate with your team to troubleshoot and fix issues fast. Try it yourself today by starting a free 14-day trial and also receive a free Datadog t-shirt when you create your first dashboard. Head to www.datadog.com slash codingblocks to see how Datadog can provide real-time visibility into your application. Again, visit www.datadog.com slash coding blocks to sign up today. All right. So we're continuing this episode on dates and times,
Starting point is 00:01:34 and hopefully the second date's a little bit easier than the first. And we'll get into that in just a minute. But as we do, we like to thank those who have taken the time to leave us a review yep so on itunes we have out at four let me start that over at fillmore east killa caleb mcelroy no i said that wrong yeah no that's right mcelroy uh ll FJK, Buster in Dallas, and Zomalot. So this is funny. I just realized that I got tossed this one first. Man, not.
Starting point is 00:02:14 So the first one is Rusty Nipple. We have Haywood, Yeah, Pinch Me, Do No Six, Do No O6, Anonymous, and Div 06, anonymous, and divisive newspaper method, which I love. And you know what's funny is anonymous. I think that's the one where they're like, I was twitching. You remember when I had messed up
Starting point is 00:02:36 when we were talking about what, was it gigabyte versus megabyte? No, not gigabytes versus megabytes. Gigabits. Megabits. What the, oh man, I can't think of it right now now we should probably look it up dang it i i said i i mentioned what the cloud like uh cloud front what they do i can't even think of anything right now oh my cdn cdn i said it was
Starting point is 00:03:01 cloud oh yeah delivery network or so i don't remember what i said but i said it was cloud delivery network. I don't remember what I said, but I said it wrong. They were twitching, and you corrected it. Yeah. They were like, oh, I felt so much better. Oh, yeah. You're right. He says, I was literally twitching that Alan got the CDN acronym wrong. Oh, man.
Starting point is 00:03:18 It's so funny because after you said it, I was like, oh, he's totally right. All right. Anyways. I just want to say, you're welcome, oh, he's totally right. That's all right. Anyways. So I just want to say you're welcome. Yes. You're welcome for, for alleviating that Twitch you had. Oh, so, uh, the only bit of news we have is I've bought my 12th laptop in a year and a half. So actually this time, I think I got a pretty good one. Hopefully by the time this episode releases, I'll actually have a couple of YouTube videos out on the thing.
Starting point is 00:03:49 So I got the gigabit arrow, gigabyte arrow 15 X nine Y blah, blah, blah, blah, blah. Don't know what it was, but at any rate,
Starting point is 00:03:58 uh, we'll have some links here in the show notes for the YouTube videos. If you're interested at all, um, I'll have my impressions, the unboxings and any kind of crazy things that I'm potentially going to be doing to the thing. So yeah, check that out. And I guess with that, that's all the news we have.
Starting point is 00:04:15 I do find it just slightly humorous. I kind of love that you messed up the name, though. The Gigabit. So I think that we should correct it. You got the Gigabit laptop. Since we had only just referenced that type of mistake moments before. Mega Gigabyte, son. I will say, though, this is the third time this week that somebody has mentioned being in the car, listening to the show, and wanting to scream about something.
Starting point is 00:04:43 Oh, really? What was the other ones so another one is a interview i did uh for uh for a youtube channel which i don't know will be published or not but so i kind of don't want to mention it until i'm sure of that uh so that that's actually real live so you get to see my face uh being embarrassed there and the other one was just uh in person oh okay this is the third awesome well glad people want to scream at us i'll give you i'll give you a hint though. If you're interested in game development, there's an awesome YouTube channel you should be
Starting point is 00:05:07 subscribed to called D&D 3d college. And maybe you'll be seeing my face on there really soon. Awesome. Excellent. All right. So the last time we talked about ISO 8601 dates, we talked about dates and SQL server. And so now we need to start going through the, the other layers of the stack. Right. And we'll go ahead and start at the next one. That's usually just a pace away from SQL. And we're going to be talking about C sharp because that's the language that we mostly do. Just be aware that I'm sure the same things or the same type things you need to be aware of in Java and whatever, you know, Python, anything else, right?
Starting point is 00:05:49 I'm sure that every language is going to have its little nuances, but we're going to talk about C sharp specifically. So one of the quotes for this portion, for this section here, because we've got more. So there was an absolutely phenomenal article written up by Zach Holman, I think is his name, and we have the link up here. You can definitely go check it out, but it was an excellent article. But his quote I loved. It was, Programming time, date, time zones, recurring events, leap seconds, everything is pretty terrible.
Starting point is 00:06:27 And that's about true if you've ever had to deal with any of it. It's way harder than it should be. And I want to remind you that ISO 8601 is your friend. You know, get familiar with that because every layer of the stack, this can help you out. Hey, you know, speaking of SPAC, I do want to mention too that coming up after the break here, we're going to be talking about dates and times in JavaScript as well. So I thought that might be like a fun foil. So make sure you stick around for that. Yeah. Yeah. We're going through the pains in every one of these.
Starting point is 00:07:00 Yeah. And I'm pretty sure that now Joe's had a minute to study the 8601. Because I know that you were saying like, hey, look, you really need to learn this ISO. Because I remember Joe was like, what? No, I don't want to bother with that. But now he's had time to do it. Now you're an expert, right? You had time to study it, right?
Starting point is 00:07:18 Right. No, I mean, I just rely on my JSON formatter to get it into JSON from, you know, into my JavaScript from wherever, whatever crap is coming from. And then once I got it in JavaScript play, and then, you know, it's pretty loosey goosey. The person who hates JavaScript, but yet only ever codes in JavaScript by choice strings all the things. Zjerzak. If you can't beat them, join them. That's right. So here's the thing.
Starting point is 00:07:44 There's not all the insanity that there was in SQL server on the C sharp side. It's actually a little bit more time. So in C sharp, your precision is stored to 100 nanoseconds, also known as ticks. Your time values. Uh,
Starting point is 00:08:01 hold on. What did we have here? Okay. So a particular date is the number of ticks since 12 o'clock midnight. And I got to close my thing that I got over here. Since January 1st, 0001 AD. So this is using the Gregorian calendar. We're not going into what all that exactly means.
Starting point is 00:08:22 If you are super interested in that, feel free to go dig up all that information. It gets deep. Um, but here's the interesting thing, and this is why dates aren't easy. The number excludes ticks that would have been added by leap seconds. Like, I think, I think Joe, you went into what leap seconds were on the previous episode. And I mean, it's just nuts. I mean, the stuff doesn't get off by much over a 20 year period, but just the fact that we're even talking about them means that, you know, different things are going to do them differently. So, you know. Yeah. And when I think of ticks, I generally think of it in terms of time spans. I know that's not the only way to do it, but every time I've ever done ticks, it's been like in terms of measuring,
Starting point is 00:09:04 like here's where it started, here's what it ends, here's the difference in ticks. And it does sound like, make sure I read this right, a tick is 100 nanoseconds. That's one tick. Yes. Okay. Because I thought nanoseconds were quicker
Starting point is 00:09:20 than that, so it makes sense to me. So one tick is 100 nanoseconds. Hey, I'm just used to seeing it for time spans i've never really thought about what it meant for leap seconds but i guess it kind of makes sense like if you tell me oh it's been a thousand million whatever billion ticks since 1970 then i can figure out what time it is now so it's like i'm using it kind of to translate and that's where i guess the leap second probably comes in maybe yeah i don't know it's the only thing that makes sense it is weird though because like if i remember right the uh standard it starts at zero zero zero zero for the year and this starts at zero zero zero one right like why why
Starting point is 00:09:59 would you you got so close man you're almost there you're so close buddy man. You're almost there. You're so close, buddy. You can make it. You could do it. And the odd part is, right, like some systems do it based off Epoch, like Linux. Microsoft was like, nah, nah, we'll go from 0.0.0.1. Like everybody does it different. And that's why the communication, the ISO 8601 actually matters because then you can translate everything to a common language, right? So the problem with the datetime in C sharp is it's very similar to datetime two that we discussed in SQL server. You can't store a time zone offset. So that, that starts to become a problem, but wait, wait, wait, wait.
Starting point is 00:10:40 Cause, cause those are two different things, right? Like there's the time zone and there's the offset. So we're saying you can't store either or one. Either. So you don't actually have those stored with it. So you can store, you can define the date time dot kind, which is unspecified local or UTC. Now, when you do local, it's just going to assume that the date that you gave it is in the same time zone as the system you're on, but it doesn't store the actual offset as far as, as far as I understand there. So that's the problem. If you're doing the UTC, it will translate it to UTC time for you or, or you're just telling it that it's UTC. You're not actually translating it. So for instance, if we were to say, Hey, we're in the Eastern standard time zone, which we, we said
Starting point is 00:11:37 last time, that's a negative five hour offset, right? So if you say that right now it's 5 p.m. Eastern Standard and you say that the date time dot kind is local, which, by the way, happens any time you just say, hey, give me date time dot now. Right. It'll automatically put it in local time because it'll do the conversion for you because it knows that the time zone it's in is on negative five offset. And then it'll convert it to UTC for you. If you call that function and it'll add the five hours to it. Now, uh, I think I might be jumping ahead here somewhere. So actually let's, let's jump into the stack overflow thing because there was, there was an absolutely phenomenal, it should have been an article that was a standalone. The answer to the question was so good. But here's what they get into.
Starting point is 00:12:31 If you're representing a time relative to some place in particular, represent it in calendar time with a date time. Just be sure you don't ever confuse one calendar with another. Unspecified should be your assumption. So what they're saying is if you get a date or a time, it has to be unspecified because you don't know whether it's local. You don't know whether it's UTC. You just have to say, we don't know what the origin is, right? We don't know what time zone it was. Local is only useful coming from date time dot now. And that's what I was saying a second ago, because when you do datetime.now, it automatically sets it to local saying that, hey, it's whatever the time zone,
Starting point is 00:13:09 whatever the offset is for the operating system that is running the program. For example, I might get a datetime.now and save it in a database. But when I retrieve it, I have to assume that it's unspecified because it did not save the offset information with it. You don't know where it came from, right? Unless you stored it specifically. And so you can't rely that your local calendar is the same as the calendar from where that database entry came from. It is curious, like why, why didn't they bother to, like, I wonder like as a decision, why? Cause they created like the daytime offset the daytime offset struck, right? They knew that, hey, this is a thing. This is a needed thing.
Starting point is 00:13:52 Why did they make it separate? Why didn't they add it to it? Maybe its default value was to something like an unspecified or whatever, right? You got me. The only thing I could think is it's weird because it's the same thing in SQL server, right? We talked about all the different data types and, and they have several, but there's only one that stores that information. So the only thing I can think is initially when all this stuff started out, they're like, Hey, everybody just wants to date times.
Starting point is 00:14:26 And it wasn't, I don't know. Maybe it's like, well, most people don't need the offset or most people won't care about the offset because they're just running an application on their computer, right? If you're creating a video game, do you really care if your video game's storing an offset for when you're playing? Now, if you're sending that data to the server, maybe. But on your local system, you're playing. Now, if you're sending that data to the server, maybe, but on your local system, you probably don't care. Right. But I kind of imagine though,
Starting point is 00:14:49 I mean like, okay. So as you were saying some of that, right, like performance things were coming to mind, like, well, maybe it would be like a performance reason.
Starting point is 00:14:56 Maybe that's why they didn't. But I'm like, no, cause that doesn't seem likely because, you know, capturing the time has to be more difficult than actually just the date offset of whatever the local and system is at that point. Because you're already saying local, so why not just include what the local offset and time zone is? Or like you pointed out last time, just do the time zone because then you can figure out the offset from that alone.
Starting point is 00:15:24 Yeah. Right? I don't know. I really don't. It's confusing. And that's the problem. It's, you know, I think it set us up for a bad pattern is where I'm going with that because it didn't have, because, and I'm not just C sharp or more specifically, not just.net, but because a lot of language frameworks don't, uh, you know, include that by default, then, you know, there's like the tyranny of the default. Right. And so you don't even think about
Starting point is 00:15:50 it and you're just like, well, I'm gonna grab a date time dot now. And that's all I need to know. And, you know, I'll log that to the database and because it didn't already include it, or, you know, I'm going to do a, a select get date from SQL server because it doesn't already include it. You're like, you don't think about it until it's already too late. And you've already got some massive amount of data that you're now trying to triage and figure out, oh, where did this happen? When did this happen? Oh, man, if only I had a time zone. Yep. I mean –
Starting point is 00:16:16 Well, I didn't want to say over the game idea. Like if the time zone ends up changing, like we just had a time zone change here in Florida, then it's kind of weird to think that your save game might suddenly be behind. Like you're playing around that time. So you can actually jump on you. Of course, if you move to, but that's like an example, you can actually be like doing something. And then like, you know, say a file messes up or something because suddenly it's behind the most recent save. But you can have that happen without the time zone too, though. Yeah.
Starting point is 00:16:41 Yeah. That's why the time changes at like three o'clock in the morning it's funny because this whole problem is it's almost like you know people ask me sometimes like you know hey i'm i'm looking to learn a new language you know why did you pick c sharp right and for me it's not a flame war it's nothing i mean i've programmed and i don't know how many languages up to this point in time and and I think all three of us have. I don't think any of us are like, oh, no, I'm never touching that or whatever. We just use whatever the tool is that's there, right?
Starting point is 00:17:13 Python. I mean, Perl. Right. But here's my thing. The one thing is when I made the decision to actually pick C Sharp, part of it was just because it's, it's sort of a prescriptive about things, right? You go into the Java world and you've got 9 million tools, 9 billion libraries. You know, it's like this endless sea of choices. And it's sort of frustrating to me to get rolling. And I feel like that's kind of what's going on here with the date time things is because you look
Starting point is 00:17:43 and you see get date. Well, that makes sense. That looks right. That's what you use in SQL Server. You see date time. You're like, oh, yeah, that's totally what I want. I'm going to use that. And so in short circuits, you're going further to find out, hey, why would I need this other thing?
Starting point is 00:17:58 Right. That's my point. The tyranny of the default. And it bothers me. And I don't know. I don't know why it happened that way. I really don't know, I don't know why it happened that way. I really don't. So you actually made a conscious decision to go C sharp then because you liked the
Starting point is 00:18:11 prescriptiveness of it. You're saying I did. I liked the fact that when I was looking for an ORM, it was an early framework, right? It wasn't, Hey, there's an hibernate. There's, there's 5 billion other things. It was just, you know, it was almost like if you were doing a DI framework. Java has a bunch of them. In C Sharp at the time, it was like, you're using Unity or Castle Windsor. There's just a couple of choices, and it just makes it a whole lot easier to get started. And that was just, I didn't want to have to think too much about how to put all the pieces together. I just wanted to start writing some code.
Starting point is 00:18:46 Joe? going to have to think too much about how to put all the pieces together. I just wanted to start writing some code. For me, it was like working with Java. We had to do some of it in school, like in college, and I do work on primarily Windows computers again to set the path. And then even the way we compile, like I use Notepad because pretty much all my co-students were doing the same thing.
Starting point is 00:19:02 It was rare to see anything else at the time. This was way back in the day. We'd do like JVAC or Java C and you'd have to pass the same thing. It was rare to see anything else at the time. This was way back in the day. We'd do like JVAC or Java C and you'd have to pass the class path. It was such a pain. And then one day I gave Visual Studio a try because I had it free through the college. And I was like, wait, I just do a new project and now I'm dragging buttons around and I can
Starting point is 00:19:18 go do these handlers. And so I just felt like instantly I was so much further ahead just with playing with C Sharp and not even knowing what I was doing. I was like, I'm going gonna spend some more time in here yeah writing code instead of learning you know how to make it all work yeah i'm with you a lot on that too because like i remember when you know early days of java it was just like okay breakout notepad and that's your editor and so yeah it was like in the early days like i guess i kind of got a bad taste because it was some of the difficulties of like what you were saying were like you know
Starting point is 00:19:49 you're on the command line and you're passing in the class pass of everything you wanted but i was already doing uh c and c plus plus development and so and specifically in like if if you remember mfc so when dot net came around it was just like a oh yeah this kind of makes sense transition to where it was something like oh there, there's some of the coolness of Java that I like. Now it's in the Microsoft world. Yeah, and nowadays the tooling is much better, right? Like if you're using something like IntelliJ or NetBeans, the tooling is way better. But yeah, for me, it was just choices.
Starting point is 00:20:23 But anyway, I digress. Yeah, sorry. So the, the next thing, so if you must always be at a certain, or if you must always be certain of the moment, make sure you're representing instantaneous time. And that means you're using date, time offset, or you need to make sure that you're using a UTC date time. So this is where things get confusing, right? So if you just do a date time dot now, again, that automatically goes to local time. If you want to use date time in UTC, then when you create that date time instance, or you're going to get that value, you have to tell it, Hey, I want the UTC version of this, or you can just use the date time offset and provide the offset that you're going to have, which is the safer way.
Starting point is 00:21:08 So it sounds like I should go into my code and do a find and replace for date time and replace it with date time offset. And now my code is magic. I mean, it's funny you say that. We recently did something like that where we realized that things were not being stored properly. And, and we kind of did that, right? Like we went through and replaced everything to make sure it was all being represented in UTC time so that it was because the problem we had was not
Starting point is 00:21:36 only is it not correct in the code, but in the storage on SQL server side, you know, we weren't storing an offset. And so now it's like, okay, well now we have to make a decision and make sure that you're putting things in the same offset, which if you're doing UTC is zero.
Starting point is 00:21:53 So did you take the database and put it in SQL user mode and then update it and then do it? Or did you like put a flag that said like, this one's been transitioned? You have to update the old stuff. Yeah, that's what it is. you know what it is, yeah. But, you know, it's kind of frustrating too, though, because even in the daytime offset, they don't include the time zone. Like, that's not one of the things.
Starting point is 00:22:13 Right. Yeah. And we'll get to some of that too. So here's the thing. If you ever need to modify a previously recorded daytime offset, you don't have enough information in the offset alone to ensure that the offset alone to ensure that the offset is still relevant for that user. You must also store the time zone,
Starting point is 00:22:30 which is what you're saying right there, but it's not part of the date time offset object. So somewhere else. Yeah. You got to keep it somewhere else. I mean, I can imagine where like a lot of people would say it might be thinking like, as they listen, like, who cares, man? Like, why do you need the time zone? But then like I was thinking to myself as you were talking and I'm like, well, if you imagine like you are like a big player that uses a lot of cloud infrastructure. Right. uh you know you're spinning up instances everywhere you know a bunch of ephemeral instances uh here and there all over the world you know as as needed on demand but you're logging back centrally right and you might want to know like oh hey you know like because specifically
Starting point is 00:23:16 netflix is the one that comes to mind right so you know it might be good information for them to know like hey there was this big we saw a big spike in traffic that happened in Europe. And if they had that date time with the time zone, they might be able to tell specific regions of where things were popular and everything. So it might be more important for them to have that kind of specificity in the times that are being logged. Yep. I totally agree. And here's the cool part is there is a list of standard time zones. So we've got a link to the Wikipedia article that has it,
Starting point is 00:23:53 and there's actually a name for it. And I thought I had it in here somewhere, but I don't see it right now. I mean, we're going to go through them. So are you ready? There's just a couple hundred of them. We can get through this real quick. Yeah, it shouldn't take long. So here's the cool part.
Starting point is 00:24:07 So we've talked about all this and, and so date time doesn't do everything you need to do. Date time offset doesn't do what it need, what you need it to do. Not all of it. So does that mean you roll your own? Well, you can,
Starting point is 00:24:20 or you could use something called nota time. So in C sharp, it's called NotaTime. It actually grew out of a Java one, and I could have sworn I had the link here. I think it was called JotaTime. Yeah. So basically, people created a library to handle the problems that you see with date times and date time offsets. So, for instance, a perfect example here is in Notatime, they have this representation called the zoned date time,
Starting point is 00:24:50 which will store both the time and your time zone information, all in one nice little packaged object. So now if you need to use that information in other places or store it somewhere, you have all that data in one spot. Hey, just... You know who did? Go ahead one spot hey just know who did go ahead joe yeah who did noted time i'm gonna go look john skeet john skeet oh i got it right yeah this is that code flow c sharp genius google employee yeah he might have a little bit of a footprint online. He knows a thing or two. I don't know. Yeah.
Starting point is 00:25:26 Yeah, there was, going back to that Wikipedia article that you mentioned about the list of time zones, it's really funny. They have a map of the world color-coded by time zone. And if you, I swear, if I were to put this picture in front of you and show you this picture, you would not realize that that's what it's trying to represent. Because within a given continent, every little country is a different color. You wouldn't recognize it. There's no semblance of meaning about it with the way it's color-coded.
Starting point is 00:26:01 You wouldn't recognize that that's what that's trying to represent. Yeah, almost no cohesion there. Yeah, it looks like you just handed a bunch of crayons to some kids and were like, here, color this in. And it was the fluorescent crayons too. Because you know that pack. Did you ever have that pack? Of course we did. Because you had your standard 64,
Starting point is 00:26:18 man. But every once in a while some cool kid had the fluorescent colors. Gonna add a little spice to your coloring book. Dude, there are a lot of these. It's, this is sort of ridiculous. Isn't it? Like, you know, you look at like, Canada might make the most sense out of all of them.
Starting point is 00:26:37 America is, it's in there, but like you get into the middle of the country and it's like, why is it so squiggly back and forth? You know, like, I don't, I don't know what's happening there. But then, look at South America or Africa. It's different time zones for each individual
Starting point is 00:26:57 country. It's not easy. And the funny part is, even if you store some of this information, I think we talked about it on the last episode, is some countries just politically will be like, we're changing how our daylight savings times work. offsets but no it totally makes sense why each one would be different because it's that that's the locale and that's why the time zone is important because the time zone tells you not only what the offset is but also the locale so i'm i'm looking at this with so the wrong exactly a wrong filter right that's why i like because i'm thinking of that you know the the standard one where you see all the lines where like here's the time zones that are happening right each one of them has their own specific here even even though it's the same offset.
Starting point is 00:27:45 Nevermind. I was, I was being dumb. Oh, you know, like, uh, I think we should get rid of time zones.
Starting point is 00:27:52 Uh, probably I think we should get rid of like time change for sure. And there's a lot of things like I have, you know, I have opinions on like, we should go metric in the U S like it's just silly. You know, I like,
Starting point is 00:28:01 I definitely have some opinions. I'm not with you on the time zone, but the other two getting rid of the, going to metric and getting rid of the daylight savings times yeah i'm with you on those two yeah let's get with it but i'll tell you man i was uh trying to look at calendars here in the background i was like there's got to be a better way let me find a calendar that's come out more recently that's like smart it's maybe like 10 based or something that's you know it fits nicely i can't find anything better than the Gregorian calendar. And I mean, it's pretty crazy.
Starting point is 00:28:30 The things we have to do to kind of keep it matching up with the phases of the sun and whatnot are all pretty silly. But as far as I can tell, there's not a better one. It's crazy to me. I tell you, if you could invent a better calendar, you could make a million dollars. I don't know. Maybe two. There's actually a page on timeanddate.com. I Googled, is there a perfect calendar?
Starting point is 00:28:49 And there's a whole page of things and reasons why none of them are. Yeah, it's just crazy. Yeah, it's terrible. And it's funny to see, like, looking at the different calendars. There was one that looks like it came out in the second millennium BCE. I don't know if that's more recent or less recent. But it's funny to see like the average year length and the average day length and the errors.
Starting point is 00:29:12 And they're all pretty much over the point. It looks like the Persian calendar is the most accurate with this only off less than one second a year. Well, the Gregorian is only off by one day every 3 236 years so that's that's i think that's why we're using it wait hold on hold on no but the revised julian calendar is roughly 10 times more accurate than today's gregorian calendar and is one of the most accurate calendars ever devised but apparently we don't use that because it'd be really hard to convert everybody at this point right do you imagine like trying to say your birthday well okay here's my gorean calendar
Starting point is 00:29:49 birthday right but in julian calendar years i'm only like you know 18 julian i was just thinking i was like there's some nerd out there with the dvorak keyboard who's come up with a really nice decibel like 10 base calendar. And it looks like actually the French had one like 200 years ago that they used for a while. But I guess the problem is like if you try to divide things up and evenly in tens,
Starting point is 00:30:12 then the second in March is different from the second in September. And so you can't use things to kind of compare. So you can't, you just can't evenly split it up. Is it wrong of me that I was picturing this nerd,
Starting point is 00:30:24 as you call it, with the Dvorak keyboard, but it was also an ergo docs. I was kind of looking at you when I said that. I was like, wow, out there. Hey,
Starting point is 00:30:35 but you know, what's really cool here. The one that you just talked about that was introduced in the second millennium BCE. I'm assuming that's recently. No, I don't know what that is, but it's the Persian calendar. So it had to have been a long time ago. This thing is only,
Starting point is 00:30:52 it's off less than one second every year. That means one day in every 110,000 years. So that's pretty good. Why don't we use that anyways? All right. So back to our inefficient, uh, wrong calendar that we all use. So the next part here in C sharp is occasionally you want to represent a calendar time that is local to whomever's looking at it. Right. And this is important. This is where it goes back to. You got to know your use case, right?
Starting point is 00:31:21 So, uh, for example, when defining what today means today is always midnight to midnight, but these represent a near infinite number of overlapping ranges on the instantaneous timeline. In practice, we have a finite number of time zones, but you can express offsets down to the tick. So in these situations, you want to make sure you understand how to either limit the who's asking or deal with translating it back to some appropriate time zone. And what that basically means is, right? Like if I want to look at things in Eastern standard time, cause that's where I am, did you want everything translated to that? Right? But then there's the opposite of, hey, even though I'm an Eastern Standard,
Starting point is 00:32:09 I want to see when this happened during the time of the day wherever it actually occurred, right? So I think we talked about last episode is, you know, if you're looking for anomalous like security data, it might be odd for somebody to be badging into a building at 11 o'clock at night, right? When everybody goes home at six o'clock in the evening. And so it's important for you to know that this happened at 11 o'clock at night where it happened because it was outside the norm of business hours. Whereas if it was in my time zone, I was saying, oh, well, it happened at five o'clock in the evening
Starting point is 00:32:40 because the translation, right? So you gotta know what you're actually trying to attempt to see there. And by the way, I love people with the Warwick calendars, calendars, keyboards, didn't mean any, didn't mean any hate there. I appreciate you. And I say love, I say nerd with love in my heart. But you know, I didn't want to say too, I don't know if you guys ever experienced experienced this but i remember um aws i think it was they had some cloud monitoring software or whatever that i would look at sometimes and try to track down an error be like okay something bad happened at 8 a.m this morning let me go look at the monitoring tool and i go there and it was in utc and so it was such a
Starting point is 00:33:22 pain to use and even though like you know it okay, either four hours or five hours or whatever, however long back I try to translate that and look at the logs, you'd be like, okay, it was eight this morning. So it's 3am over there, but you're kind of zooming in ranges. You're trying to like cost correlate logs within different time zone, such a pain in the butt to not be able to kind of say like, just translate into my time zone. So I don't even know you think like, you just got to add five, you know, it's not that hard.
Starting point is 00:33:46 It kind of is, especially with the 12 hours, you know, AM, PM thing and then the cycling over the day and changing, like, surprisingly annoying to work with. Yeah, especially after it crosses that 12 PM or 12 AM threshold, right? Yep. I really thought you were going to bring up the bookmarklet. Oh, yeah. Do you remember that? Yeah, I wrote a little bookmarklet to translate the times. Yeah, it was a little bookmarklet. Oh, yeah. Do you remember that? Yeah, I wrote a little bookmarklet
Starting point is 00:34:05 to translate the times. Yeah, it was a little bookmarklet. You just click that, put that up in your toolbar because you could use the JavaScript to manipulate the current page you were looking at and it would just change them.
Starting point is 00:34:15 That's beautiful. So, yeah, I actually asked that on Stack Overflow and every once in a while I still get an upvote where people are asking about it. I think it was CloudWatch. CloudWatch time zone. I asked a frustrated question in Stack Overflow
Starting point is 00:34:28 and even though I think they fixed the problem so you can select your time zone now, every once in a while someone drives by and gives me an upvote. Drive by upvote because it's a pain or it was a pain. So specific to date time offsets in C Sharp, if you compare two date time offset values, they are first normalized to a zero offset before comparing, which kind of makes sense, right? Like, you know, basically put them into UTC. So, you'll take something with an offset, it gets converted to UTC, and then they check to see what the difference is between them. Because otherwise, how are you going to compare the values?
Starting point is 00:35:05 So it makes sense. Yeah. It's basically like doing math, right? You have to get to a standard unit. So, so basically though, it's more than,
Starting point is 00:35:15 it's not that they're doing like an equality check, like, Hey, is this to have the same, uh, value as this one? It's do these represent the same point in time? Exactly. So, I guess
Starting point is 00:35:28 that's actually kind of a key thing then, because if you wanted to make sure that it was the same object, or, yeah, yeah, because I'm trying to, like, say the value of it, but yeah, because it doesn't have to be the same instance of the same, because these are actually structs, not objects. Right. But,
Starting point is 00:35:44 but, yeah, so you're not looking for, looking for like a pointer comparison but even if you wanted to just make sure that like it was the same exact string of text let's say it's not it's actually it's actually converting the string right like if we're referring if we think of the time the fully qualified time as a string of text right it's not just verifying that those things are the same. It's actually converting them to the same base and then comparison. So, you know, maybe you're in a situation where you want to see if the two strings are
Starting point is 00:36:12 equal and then that might, but I'm trying to think of like what a use case for that might be. So maybe you would never care. I don't know. But basically what you're saying is if I say it's 5 p.m. Eastern standard, compare that to my 10 p.m. U utc it's going to say they're equivalent yeah so yeah so maybe that's a better way of saying it's not that you know it has an equality
Starting point is 00:36:33 operator because there's not a such thing as an equivalent operator but really that's what it's doing is it's really you're doing checking for equivalency uh let's see oh so what they were saying here is if you're doing any unit testing and you need to be certain of the offset, then you need to test both the date, time, offset value and the offset property separately. So that's how you test that. Wait, say that again. So if you're trying to test for equality between what your inputs were versus the actual point in time, then you need to check the time and
Starting point is 00:37:05 the offset individually. Oh, in order to make sure that it was the same input? Yes. Like going back to the, instead of checking for equivalency, if you wanted to check for exactness. Right, right. Now, that said, if you are doing any kind of test that rely on date time, you shouldn't be using it from the clock. Those should be, like, known values that you're using for that.
Starting point is 00:37:31 Like, that state should be injected in as part of the test. Right. Not just reading something from the system time on the current running instance. Yeah, you wouldn't be able to guarantee it based off wherever you're going. Right. and be able to guarantee it based off wherever you're going, right? So this is the other thing that I think we sort of got to earlier is there's this one-way implicit conversion that's built into the.NET framework that allows you to pass a date time
Starting point is 00:37:57 into any date time offset parameter or variable. So when you do this, the kind matters. If you pass the UTC kind, it'll carry it with a zero offset. But if you pass it to the local or unspecified, it will assume to be local. So even local or unspecified, it treats it as local, which seems sort of wrong. The framework's basically telling you that, hey, even though you asked me to convert this calendar time to instantaneous time, but I have no idea where it came from. So I'm just going to use the local calendar.
Starting point is 00:38:29 So just know it's going to implicitly convert that to local time for you. If you do anything other than UTC. So this can be a big, a big thing. If you load up on specified date, Tom on a computer with a different time zone. So basically if wherever that data came from initially isn't in the same time zone as where you loaded it up again, it's going to treat it like it was local time.
Starting point is 00:38:53 And so you're actually going to be getting incorrect information. Yeah, it's almost unfortunate they even provide that capability. Agreed. Like, what benefit do you get from them just making that assumption for you? Uh, yeah, I really don't get it. The guy who wrote this, uh, stack overflow reply, it's Matt Johnson. He actually has a plural site course on this. We have links to both stack overflow and the plural site course. But even he said, he's like, man, this should actually throw an error. If you were to do something like this, the safer bet so that people didn't realize that they were making that mistake is just throw an error.
Starting point is 00:39:33 Hey, you don't want to do this. Hey, real quick. I was just looking at that course, actually, on Pluralsight. Don't click it. You want to guess how long that video is? That course? Date and time Fundamentals. Four hours.
Starting point is 00:39:48 Dang it. I was going to say four hours. Three point eight hours. You're both wrong. Six and a half hours. Yeah, six hours and 20 minutes. Oh my gosh. Wow.
Starting point is 00:40:01 That's so close. Yeah, and check this out. It's got a perfect five-star rating with 500 views, and the level is intermediate. For date and time fundamentals. Date and time fundamentals. Six hours. Six and a half hours. Intermediate. You thought you learned how to tell time in grade school.
Starting point is 00:40:18 Yeah, it's ridiculous. I mean, this stuff is way harder than it should be. But then you start thinking about it, and you're like, oh, I get it. Yeah, I don't really know how I'd solve that. So the section on common mistakes and best practices is almost one hour long, 56 minutes. Golly, man.
Starting point is 00:40:34 Oh, so going back, I mean, if you're just listening, the one that you want to look up for C Sharp is NodaTime, N-O-D-A-Time.org. And the one for Java is Joda.org. So again, they're super helpful libraries and there's a good reason they exist. Man, this is interesting. His actual description about himself, Matt Johnson, he specializes in date and time related issues.
Starting point is 00:40:59 Isn't that crazy? Talk about not, I mean, not trying to take away from him. Who knows if he's a T developer or whatever we want to call it, but that dude's hyper-specific in what he does. That's what I'm saying. Imagine, okay, let's go back to you're in high school, right, and you're meeting with your guidance counselor to go over possible jobs. Never, ever did that come up that you could focus on date and time related issues.
Starting point is 00:41:26 Hey, dude, I know what I'm going to do. We take a lot of stuff for granted. But you got to remember that whenever whoever comes up and decides that it's going to be a leap second added, like President Trump's got to get on the phone to this guy and be like, hey, Matt, I need you to add another second. Yeah. Someone's got to answer that bat phone, and that somebody is Matt Johnson. Yeah, apparently. Yeah, he knows his stuff. So some of the benefits that I think that we should at least touch on real quick on the Noda time and the Joda time, probably.
Starting point is 00:41:58 I didn't do a deep comparison of the two, but I assume that one was built off the other. So here we go. The key benefits, it can represent an instant based off the popular epoch. So a lot of times, if you're dealing with systems that interact with each other, going across Windows to Linux, to Mac, to whatever, epoch is sort of the standard that everybody goes with. Note of times got you covered. You don't have to do any more of this math in your code to figure out, Hey, what's the epoch from my C sharp date time to whatever. So that's a big one that it's built into it. And the code is literally system clock dot instance dot get current instant.
Starting point is 00:42:38 That's it. You have your, you have your epoch value. So that's beautiful. It supports the time zone database of zones, which was what I alluded to value. So that's beautiful. It supports the time zone database of zones, which was what I alluded to earlier. So for instance, it's all full name based. And I think we talked about this in the episode with SQL server, where it's not like you're going to have, you know, East slash GA it's the full name. So for instance, if you're going to do London based time zone, you would say date time zone providers dot time zone DB is actually what it is. TZDB. And then you pass in Europe slash London as the key. And that will give you back the appropriate standard time zone.
Starting point is 00:43:20 It's more expressive and intentional in its declaration of the date. So this is kind of an interesting one, right? So like a potential sample of code would be like var local date equal new. And instead of date time, you actually say local date time. There's a novel idea, right? Name it something that makes sense. And then you can pass in the year, month, day, et cetera. Now you can also say we had,
Starting point is 00:43:51 so we did the London one just before where we said like var London equal date, time providers.tzdb, whatever. You can also say, hey, give me London.at strictly and then you can pass in that date that was currently done in the local date time and it'll do the conversion for you. So it's very expressive. It's none of this ambiguous date time, date time offset. What does that even mean? You now have methods that are named in ways that make sense. So what else do I have here? So I think that that was it as far as what the
Starting point is 00:44:22 note of time, there's probably way more in depth pieces that allows you to do, but those are some of the key points that I thought were really interesting. You gotta love, uh, JavaScript too. There's a JS Joda NPM package. Really? I can't speak to how good it is or anything like that, but there is a JS-JOTA. Well, we're going to start hitting on JavaScript here in a minute, too, and that starts getting a little bit wacky. So there's a few other additional gotchas in C Sharp, and I'm sure every language has their own as well. If you're assuming US English as your culture but your software is running on a server with a culture that is set to something else, parsing dates and formatting
Starting point is 00:45:10 can really start to cause you some pains. So I've actually run into this before where you assume, Hey, everything's your, your, your month, month, day, day. Well, you start going into other locales and guess what? You know, those things are in different formats. And all of a sudden, your string parsing for your dates fail. So there's one way around this is you can use the invariant culture, which know about this. It may help save you a lot of pain in the future. But it's basically culture insensitive. So it's similar to the UTC for the actual date itself. This is for the culture and it's very similar to the English
Starting point is 00:45:54 way of representing a date time, but it's not associated with any particular country or region. So if you, if you say that, Hey, this particular date time parsing is going to be an invariant, it should work everywhere. So be aware of that. Yeah, I remember something similar to that, too, related. Joe might recognize this from the CLR via C Sharp, where, you know, if you were doing string comparisons, but you knew like where the, if it wasn't from like the user kind of input or something like that, then, uh, there was a speed performance that you could get from doing invariant
Starting point is 00:46:33 cultures. Ordinal dot compare case using invariant culture. Help. Yep. You know, I was just looking at the JS Joda and I was really bummed that they didn't just do J soda. I thought that would be really cool. So I just Google, I was just looking at the JS Joda, and I was really bummed that they didn't just do J Soda. I thought that would be really cool.
Starting point is 00:46:47 So I just Googled. I was like, let me see if there is a J Soda. There's like 500 J Sodas. Really? I don't know about that. I only looked at the first page. But I couldn't believe how much J Soda was used for other stuff, like I guess JS and then whatever ordinal data anomaly detection.
Starting point is 00:47:07 There's all sorts of acronyms that people already filled in. So if you've got an idea for a JavaScript library, you need to hurry up and land grab that thing. Buy the domain now. Yeah, get a.dev right now. Yeah. Crap, that was my tip of the week. Now I've got to find something else. This episode is sponsored by Clubhouse. Clubhouse is the first project management platform for software development that brings everyone together so that teams can focus on what matters, creating products their customers love.
Starting point is 00:47:34 While designed to be developer first, the UI is simple and intuitive enough for all teams to enjoy using. And Clubhouse is truly built for developers by developers. And you can really tell that because they've sprinkled some Git tips throughout the UI, and they even make a really big point to highlight open source projects that integrate with them. Yeah, and they also add like fun things to it as well. So now you can use emoji reactions to react more quickly to your story comments in Clubhouse. With a simple API and robust set of integrations, Clubhouse also seamlessly integrates with the robust set of integrations, Clubhouse also seamlessly integrates with the tools you already use every day, like Slack or GitHub, for example.
Starting point is 00:48:10 It's getting out of your way so you can focus on delivering quality software on time. So go ahead and sign up for two free months of Clubhouse by visiting clubhouse.io slash codingblocks. Again, visit clubhouse.io slash coding blocks to get your two free months and see why companies like elastic full story and launch darkly like clubhouse. All right. So with that, it's that time where we ask you, Hey,
Starting point is 00:48:36 if you haven't already left us a review, we would greatly appreciate it. If you would take the time, you can find some helpful links over at www.codingblocks.net slash review. And also, you might have heard me say it once before, you know, share us with a friend. If you have a friend who is also a developer that you haven't already mentioned us to, you know, and you think that they might enjoy the show, please let them know. And with that, we head into my favorite portion of the show. Survey says,
Starting point is 00:49:12 all right. So a couple episodes back, we asked, Hey, what do you think of jam stack? And your choices were, it's like the future, yo, or, eh, What do you think of Jamstack? And your choices were, it's like the future, yo.
Starting point is 00:49:26 Or, eh, I'll let this front end fad pass and maybe grab on to the next one. Or, you can pry the back end from my cold, dead hands. That's amazing. All right. So I think you haven't gone in a while, first. So, Alan, you go first. What's your pick in the percent? I don't know what our audience is going to pick here.
Starting point is 00:50:05 I'm going to say I'll let the front end fad pass and maybe grab on to the next one. I'll go with 38%. Okay. 38%. And I think that 20... No. That's not enough to win. I think
Starting point is 00:50:23 35% of the vote went to option four, which is Joe confused us so hard on the episode about what's jam or what's not that we didn't know which way is up. It's obviously WordPress. That was option number four. I'm going to say whatever I just said. You can pry the back end from my cold, dead hands. All right.
Starting point is 00:50:47 So 38% and 35% for you can pry the back end from my cold, dead hands. All right. And you got to say it like that. You do. That's key. Well, then, yeah, you both lose. I'm sorry. But, Alan, you were super, super close.
Starting point is 00:51:10 Doggone it. Super close. Eh. Was the top choice. 36. 37%. You missed it. Wow.
Starting point is 00:51:18 I'm only going to miss it by 1%. So close. And you can pry it from my coat. I'm sorry. I got to say it. You can pry it from my coat. I'm sorry. I got to say it. You can pry it from. I feel like I'm playing Overwatch right now. It's high noon.
Starting point is 00:51:32 That one was last. That was last choice. Yeah. You know, the only reason I picked the second one is I think everybody's just a little bit worn down by how much front end stuff changes. Like, you know, minutely. Well, I don't know that we've ever, like, not been tired of that. That's always been a thing, right? It's nuts. I'm so tired.
Starting point is 00:51:52 Although I don't think it's as bad as it used to be. Like, I feel like in the 90s, it was like every three months there was some major game change technology. And at least now it's like it's stabilized, you's stabilized. React has been a thing for several years now. Angular has been a thing for several years now. I'll give you that. I'll give you that. Alright.
Starting point is 00:52:14 For today's survey, we ask, who's your favorite cloud provider? And your choices are... Wait, hold on. The way that that you said that don't you have to be like we surveyed 100 people oh right and the answers are up on the board i was actually waiting for it the way you said it i was like aha in typical uh family feud fashion yes yeah sorry sorry survey okay uh who's your favorite cloud provider? And your choices are Amazon AWS,
Starting point is 00:52:47 baby. The original gangsta of cloud providers. Or Microsoft Azure. Remember when they called it Windows Azure? Awkward. Or Google Cloud, because I also need them to know how I cloud. Or IBM Cloud, I'm all about the business. Or Rackspace Cloud, big enough to be a big deal, small enough to care. Or Linode, you gotta love that pricing. Or Vulture, bare metal for bare prices. Or Digital Ocean, a refreshing droplet. And lastly, Other, because how did you not know about my dog's groomer's dad's side cloud business? That's going to win. Yeah.
Starting point is 00:53:44 I just looked up who invented the cloud. It's quite contentious, though. There's a guy they gave credit to in the 60s when he was working on ARPANET. There's actually a guy who first used the term back in 1996. But yeah, I mean, it's AWS. Do you remember when
Starting point is 00:54:00 it was all... Get out of town, man. Do you remember when it was all... What are you getting out of town about? all you said it's AWS for the original cloud provider. Come on. Oh, Oh, Oh, Oh,
Starting point is 00:54:11 okay. Well, I thought you said who said it or who, who, Oh no, they didn't say it for. Okay. I definitely,
Starting point is 00:54:17 like, I think everyone identifies with like the big cloud. Yeah. I'm with you. Yeah. You guys remember when all the marketing came out and it was so confusing, like everything was about the cloud. And it was like,
Starting point is 00:54:26 wait a second, nobody knows what this is. Like they would try and advertise to the everyday consumer. Like it's all in the cloud. It's like, wait, what are you talking about? It's someone else's computer.
Starting point is 00:54:35 Yeah. Yeah. Oh, did you know Larry Ellison, the guy from Oracle, uh, who once famously denounced the term cloud computing is actually, uh,
Starting point is 00:54:43 taking credit for the concept. I didn't know about that. That's good. Makes sense. This episode is brought to you by StellarRes. Are you overwhelmed with in-mail or inbound job opportunities? How about ignore all the inbound emails or just say delete and try StellarRes, which helps you find job opportunities
Starting point is 00:55:05 you're actually excited about and wouldn't have found otherwise. Stellarez knows that a job is much more than how it sounds at a job description, so they built their AI-powered talent agent to help you find your ideal job. Stellarez does all the work and screening for you, scouting the best companies and roles, and introducing you to opportunities outside your network that you wouldn't have found otherwise. Combining deep AI matching with human support, Stellarez pairs things down to a maximum of five opportunities that tightly match your goals, like compensation, work-life balance, working on products you're passionate about, and team chemistry. They then facilitate warm intros, and there's never any pressure, just opportunities to explore what's out there. To get started and find the job that's just right for you,
Starting point is 00:55:54 visit stellarez.ai slash codingblocks. That's S-T-E-L-L-A-R-E-S dot AI slash coding blocks. All right. And so now we are heading into the last bit of date time stuff that we will discuss for any amount of time further. I think we're done. That's it. We're all out of time. We're going to get it.
Starting point is 00:56:26 So here's it. We're all out of time. So here we go. JavaScript, what everybody's been waiting on, right? Man, this is going to change by the time we finished the conversation. All right. So I'm curious,
Starting point is 00:56:35 what is your guys's favorite place to go for JavaScript documentation? Google. Yours is Google. Okay. What website? Stack Overflow. Okay? Okay. What website? Stack Overflow. Okay. Okay.
Starting point is 00:56:48 All right. So you're obviously searching for JS problems 90% of the time. So it's funny. Like when you Google most JavaScript things, like if you look, you know, array properties or something like that, there's always two things that come up and it's W3 schools and it's Mozilla and clearly Mozilla Mozilla's docs are really good on JavaScript. So good. They are.
Starting point is 00:57:14 So we have a link here to the JavaScript reference for global date objects. So you can go take a peek through that and you'll find out some, some interesting things, which we'll cover here. I like to read it every night before I go to bed. It's funny that you said it. I've been to the docs for dates for JavaScript so many times. Let's say every
Starting point is 00:57:36 couple months, I'm like, there's got to be a better way to do this than just Vanilla.js. I just need to add a day or I just need to figure out the difference between two days or I need to format a date. And I go here and I'm I'm like no there's really not a stupid way to to format date better do whatever I want to do better but I've been to the stage so many times just thinking like there's got to be something like es17 or something's going to have an easier way to do this yeah because you forget yeah you forget you're like it can't suck this bad yeah like how like how many times have
Starting point is 00:58:01 you done the whole like date dot get month thing and then forgot to add the one or whatever? It's like because it's zero-based. Like nothing else is zero-based in date and time land. Oh, I've definitely screwed that so many times. Wait, zero-zero? Yep. Oh, man. Yeah, you don't even know you're wrong until January.
Starting point is 00:58:20 Dude, that's what happens every time. It's like the end of the year happens. Everybody's like, why are all my dates shifted? Oh, that bug's been there for seven months, man. Oops. Yeah, I'm still used to fake data and stuff in systems. As long as it looks like a date, I was like, probably right. I don't know.
Starting point is 00:58:38 Yeah, even though it shows today's date, you're like, yeah, it's March-ish. There's dashes where there's supposed to be dashes and colons where there should be colons. It's good enough. I see numbers. I see numbers. So yeah, JavaScript date objects can be instantiated by calling JavaScript date as a constructor, calling it as a regular function without a new operator. And this is kind of interesting.
Starting point is 00:59:04 It'll return a string rather than a new operator. And this is kind of interesting. It'll return a string rather than a data option than a data object. So hear me out. If you call it as a regular function without the new operator, it will return a string rather than a data object. Thank you, JavaScript. So yeah, unlike other JavaScript object types, JavaScript date objects have no literal syntax. So, you know, like if you want to new up an object, it's the curly brace, open, close. If you want an array, open, close brackets, strings, et cetera. They don't have one for dates. So fine. But just know that how you instantiate it matters. Well, depending on what you want to do with it.
Starting point is 00:59:45 Be aware of that. Yeah, depending on what you want. Oh, man, don't do that to me. So what Joe just said is true. The argument for the month index is zero-based. So if you're newing up a new date and you're passing in the year month, know that month zero is January. It matters.
Starting point is 01:00:05 And if you're doing a get month off a date object, it's also zero based. So know that, you know, 11 is not November, it is December. So where data is called as a constructor with more than one argument, if the values are greater than their logical range, like 13 is provided as the month value or 70 for the minute value, the adjacent value will be adjusted. So this is kind of cool if you're trying to do date math type stuff. So what they're saying is if you were to put in, let's say, January 1st, 2019, right, if that's what you were operating off of, but for some reason you went over on the hours and you went 25 hours, it's going to take you into January 2nd. It increments the next up thing. So be aware that that happens. Well, I mean, that's kind of a nice convenience. It allows you to be lazy for
Starting point is 01:01:02 math operations on dates. So if you just want to say like, okay, whatever today's date is plus 47 days. You can do it. Then boom, you're going to get back a date object that is your date, right? Well, but you'd also have to – that's the thing. It's not actually date addition because 47 days, how are you going to put that? Because – Well, i'm saying like if you took the the date today the day of today right and added 47 to it and created the object
Starting point is 01:01:33 but we're not talking about adding it afterwards we're talking about when you define it so if you have but that's what i'm saying if you're gonna try and add 47 days with that we have to try it uh to the console i don't so i i'm not sure that that works because what is what it does work so i just created a new date the year is 2019 the month is zero uh-huh and the uh the day is 47 and i got back februth. Right. No, that makes sense. But what I'm saying is if you're trying to do date math from today, I don't think it works like that because you'd have to figure out what today is, right? Right. So let's say – so in my example, you already have a date object. So you already have what today's number is.
Starting point is 01:02:19 Okay. And now you say that number plus 47 create a new object. Oh, if you're creating an offset. And the new date time object would be fast forwarded to what, like whatever the proper now I'm with you. So that's what I'm saying. Like it allows you to be lazy about your math. I got you.
Starting point is 01:02:34 Right. That makes sense. Hey, pop quiz. If I do new date, the year is 2019 and the month is 15. What date am I going to get back? Uh,
Starting point is 01:02:43 it'll be the year 2019 and month 15. It would be something in 2020. It'd be 2020, April 2020. But hold up, hold up, hold up. No. Yeah. April. Yep.
Starting point is 01:02:55 So that's why you should never do this because it's confusing and weird. Yeah. Because it was a zero based offset. Yeah. You're trying to hurt my head. I think I have a headache now. All right. offset. Yeah, you're trying to hurt my head. I think I have a headache now. Alright, so where date is called as a constructor with more than one argument, the specified arguments represent local
Starting point is 01:03:12 time. If UTC is desired, use new date with date.utc and then put the arguments inside that. Yeah, I feel like this is something PHP would pull. It's kind of garbage, right? So basically what they're saying is if you want a date in UTC, then you're basically going to new up a date with another date object inside of it. Whereas if you want local time, you just new up a date and then pass arguments in. So it's kind of a weird, funky way of going about it.
Starting point is 01:03:42 Go ahead. I'm just making stupid jokes. I'm just thinking like this is JavaScript. I see what you're trying to do here. You're trying to be nice, but we're not friends. Don't try to be nice. If I pass something wrong, just tell me it's wrong. We don't have to pretend to like each other. We can make that same thing for C Sharp
Starting point is 01:03:57 with some of his decisions too. Dates have not been anything good anywhere in the stack that we've discussed so far, right? They're all confusing. All of it. They're all different. They all have different starting points. Yeah, it's ridiculous.
Starting point is 01:04:13 But I want to be clear, what we're talking about right here right now is Vanilla.js. This is what comes in your JavaScript engines. Well, only if you can tell me when now is. Oh, God. We've all failed. We can't even do it i tell you we just passed it we did pass it yes if you say it's now equal now it can't right because there's trucks uh anyways i don't know me i had a debugger in there at the middle and see all right so check this out if you have an object and you use dot or if you have a date object and you dot value a unix timestamp was which is an integer based value representing the number of milliseconds since
Starting point is 01:04:51 the epoch which is january 1st 1970 utc at zero zero zero zero zero for the very beginning of the day with leap seconds ignored that's good at least that's consistent with most of what we've seen so far. Now, here's the weird thing is they do have a little caveat there saying Unix epoch, but consider that most Unix timestamp functions count in seconds and not in milliseconds. So the JavaScript version of dot value uses milliseconds for time since the epoch, whereas most Linux systems use seconds since epoch, because that doesn't make it harder on anybody. They sort of implemented the standard. So that happens. A new date, if you're calling new date, that actually typically or not not typically if you're using the literal new date up then if no arguments are provided the constructor creates a javascript date object for the current date and time according to the system settings for the time zone offset so if i knew it up on my system new date it's going to give me a time value of right now eastern standard time
Starting point is 01:06:03 which is going to be offset a time value of right now, Eastern standard time, which is going to be offset of negative five hours. All right. If we do a new date and we pass in at least two arguments, any missing arguments are either set to one if the day's missing or zero for all the others. So it defaults them all for you. So that's kind of nice. You don't have to pass in, you know, 2019 one, zero,
Starting point is 01:06:28 zero, zero, zero, zero. It'll do it for you. You can short circuit it. I guess that's a nice thing. Um,
Starting point is 01:06:36 the job you're doing, like, why did they make the, why the distinction? Well, okay. So I guess it had to be two because of the other overrides how would it know which one to well no because those were value and well it's all okay because it couldn't be value
Starting point is 01:06:51 and because how could they distinguish between value versus years so that's why they had to do the two yep this is pretty slick all right so the javascript date is based on a time value that is a millisecond since midnight, January 1st, 1970 UTC. A day holds 86,400,000 milliseconds. The JavaScript date object range is negative 100 million days to 100 million days relative to January 1st, 1970 UTC. So I don't know. How many is 100 million days? Who's got the calculator up? 100 million times or divided by 365.
Starting point is 01:07:39 That'll tell us how many years. That's a lot of years. So that's 273,972 years. I think that covers it. I don't think we're going to have- How many years did you say? Two what? 273,972 years.
Starting point is 01:07:55 Man, we just needed one more. So that'll probably cover any to-do list things that we have on our do list right i'm thinking we're all right i think we're okay there so that's that's kind of cool it's got a big it's got a big range and then the javascript date object provides uniform behavior across all platforms that's nice at least for that language it's not across all languages but at least this works the same everywhere you put it. So I assume they're talking about if you're using Node.js, if you're using Chrome, Firefox, if you're on Mac, Windows, whatever, it doesn't matter.
Starting point is 01:08:35 It works. And what that means is the time value can be passed between systems to create a date that represents the same moment in time. That's very important. The same moment in time right here is 5 p.m. Eastern is going to be 4 p.m. What's the time zone next to us? Is that central central? And then that's going to be 3 p.m. Mountain and two. Well, I guess mountains right there with uh with pacific but at any rate that point in time there's four time zones but but mountain and uh pacific i think are roughly the
Starting point is 01:09:13 same aren't they no no pacific's three central central is yeah central is one hour offset mountain is two hour and Pacific is three hours offset. Oh yeah, you're right. Okay, so good. So I don't even know what I'm talking about. So time is hard.
Starting point is 01:09:31 Time is hard. So, so basically though that point in time, the important thing is that's literally an instant. Any, it doesn't matter where it was in the world. That one instant in time is the same if you pass it across systems through JavaScript. So that's kind of nice, right? Again, you're not going to have time zone information or anything, but you know, there you go. Hey, you guys look pretty close to a time zone
Starting point is 01:09:54 break. I don't know if you ever like had to deal with that. I always wondered about like people who live like near the edges of time zones are also up area codes for back when that mattered for calling people. It would stick to thinking like, well, I live on the boundary of a zip code or an area code. So if I need to call my kid's school or call Domino's to order pizza, it's long distance, even though it's right across the street. Well, that doesn't matter with cell phones anymore, right? But not anymore. But times it still does. It's like, OK, let me call my nearest Domino's.
Starting point is 01:10:21 Oh, wait, they're in the next time zone over. I guess I can't get pizza because i don't know how to deal with this i would imagine that's actually a real thing for people that might work in a different time zone but their kids go to school in a certain one like i would imagine that happens for people that are right because we're not far from the border of it i mean yeah we're far enough to where it's not really a problem i mean it it used to it did used to get me a while though because i used to um drive up to nashville regularly and you know i would every time forget that i'm crossing a time zone and so
Starting point is 01:10:53 it would always throw me off you know like i would be there get there too early or right you know i'm like or i'd look at the clock and be like oh it's not so bad and then you know because like especially because at the time you know you'd have your phone that would automatically like change the time based on like whatever cell tower you happen to connect to right so you'd be like oh i'm doing pretty good on time and then you'd start to leave and you cross that time zone you're like oh dang and it's funny how how just that little change in your head really messes you up like you said earlier trying to calculate the things in cloud watch you're like oh man, I can't. I can't do this.
Starting point is 01:11:27 I found a funny comment on Reddit where somebody asked about the people who live on the edges of time zone, what it's like. The first person, 510 points, says, I wake up at 6, I go to work at 6.30, get clocked in at 8, clock out at 5, and get home at 4.30.
Starting point is 01:11:44 That's really odd. That's awesome. So here's, here's the thing that is kind of interesting. There's a mention in the JS docs that GMT and UTC are the same sort of. So we have a link to it here, but there is an important distinction. So GMT is also known as Greenwich Mean Time, is often interchanged or confused with the Coordinated Universal Time, UTC. But GMT is a time zone and UTC is a time standard. And those are important.
Starting point is 01:12:23 UTC is not associated with any particular time zone. There's no country or anything, even though it's right over, you know, Great Britain, it's not associated with any particular location. So neither UTC nor GMT ever changed for daylight savings time. So technically they're sort of interchangeable there. However, some of the countries that use GMT switch to different time zones during their daylight savings time period. That's crazy. So they literally switch time zones. Not that they're in a time zone and the daylight savings time changes.
Starting point is 01:12:58 They switch time zones. So that just adds to the madness of how you potentially store that information. And then they have one last thing here, I think, that I have on the vanilla JS stuff, which is if you do date.prototype.toISOstring, it will actually convert a date to a string following the ISO 8601 extended format. So that's nice. Thank you, JavaScript, for actually implementing ISO 8601. That's actually kind of sweet. So I've been reading about people who live near the time zones. I've had an article about a town that's in two states, and it happens across the line.
Starting point is 01:13:44 And there's a place where there's a bar on one side and and it happens across the line. There's a place where there's a bar on one side and a bar on the other side. One of them gets to stay open an hour longer. They interviewed that guy and he said he liked it. He mentioned if the taxes were different. It's like, ooh, do we have to choose between
Starting point is 01:14:00 cheaper taxes or being able to stay open an hour later. It's pretty goofy. Yeah. Just don't move near a time zone line and you're fine. Hey, I found something kind of interesting along those kind of fun lines. So if today on the Gregorian calendar, if today is, say, the 14th, March 14th, what would it be on the Julian calendar?
Starting point is 01:14:26 Well, the Julian calendar is more accurate. I think the Julian. I bet it's Marcos 14. We'll be earlier, right? We're probably going to be on the Julian calendar. It's probably March 8th. The first. The first.
Starting point is 01:14:51 You'd be 13 days younger. Wow, all right. Which, if you just had an infant, then that would really be difficult to explain to the doctor how all it, well. Julian. No, no. Not my kid, Julian. No, no. Not my kid, Julian. The calendar Julian. Yeah.
Starting point is 01:15:09 I mean if you had – if your son or daughter was born like two days ago, you'd have to go into negative numbers with how many days old they are. That'd be amazing. Depending on the calendar. Oh, I got a fun question for you. What time is it on the International Space Station? Oh, they got to be in UTC. I'm going to go with, are we talking about right now our time? I'm going to say it is March 15th and 3.47 a.m.
Starting point is 01:15:46 Nobody knows. What? You can't ask a question that has no answer. Well, it was originally on Houston time because that's where it launched. But it does sound like maybe they just kind of stuck with coordinated universal time. Okay. So I was right. UTC.
Starting point is 01:16:01 So it would be March 15th at 3.57 a.m., right? Yeah, that's what it seems to be what most people think, but it turns out nobody actually knows for sure. So you asked an impossible question to answer. I didn't kind of say that our notion of time and perception, the things we use to measure differences in things, is so totally tied to our planet. It's kind of like, you know, what happens if you're born on Mars?
Starting point is 01:16:30 You know, what's your zodiac sign uh i don't know i bet somebody figured that out they don't know nobody knows what time it is on the space station but i bet they know what your sign would be if you're born on mars man that reminds me so this is completely off topic and a complete tangent but that's what we do here have you guys seen on Netflix, this show called this crazy rock? Nope, dude. Check it out. It's amazing. It's narrated by Will Smith,
Starting point is 01:16:52 but it's, it's all the crazy, just interesting, weird things about this planet. And it reminded me when you were like, Hey, if you're out in space on the space station, the very first episode has that a guy who was up in space and talking about like when something went wrong one time.
Starting point is 01:17:13 But at any rate, it reminded me of it. We're talking about the Martian? No, not the Martian. But it's absolutely fantastic. Highly recommend it. It's a very interesting watch. Like when you find out where most of your oxygen on the planet comes from, it'll blow your mind. Like there's, there's just some really cool stuff in there that I never knew about. Uh, so anyways, back to the topic at
Starting point is 01:17:38 hand here. So the last couple of things I want to mention about, about JavaScript. So there are some major shortcomings in JavaScript date object implementations, like Joe mentioned earlier. If you need to do date differences, if you need to do date addition or math or anything, maybe formatting, right? Formatting dates is way harder than it should be. All these type things. There are unsurprisingly a few JavaScript libraries out there for handling this. And two of the more popular ones are, and I'm going to name these in a backwards order from what I have listed here.
Starting point is 01:18:15 One of the probably really popular ones that has been out for a while is called moment JS moment JS. And what are you? I got to get another tip of the week. What the heck, man? What? What?
Starting point is 01:18:28 You didn't read the show? Those. No, man. This is the second one. I'm all right. Hey, you can't be mad at me.
Starting point is 01:18:36 It's right there. That's hilarious. So, so moment Js has been around for a while and it's one of the ones that people use for doing all that. Just for a moment, just for a moment. But like all kinds of date utilities, right? Addition, subtraction, spans, formatting, all that.
Starting point is 01:18:56 So if moment JS has been around, it's been popular. Why anybody go and create another one? So it turns out during my research that they can't, there was another library created called date dash FNS. So the main, the primary reason why this one was created is, is I guess moment JS is kind of big. I'm sure it's not huge, but even more so is moment JS wraps the internal JavaScript object or the internal JavaScript date object. And so its performance isn't as fast, whereas DateFNS actually utilizes the JavaScript date prototype and it expands on that thing. So milling up dates doesn't incur the hit of creating an object that then wraps a JavaScript date object.
Starting point is 01:19:46 So, they've done some benchmarking on this thing, and it is hyper-fast compared to Moment. Especially, just imagine you have a grid that you're loading up 10,000 date objects, and you're formatting all those. Date FNS is going to perform much faster. And another thing that they say is it's a little bit more piecemeal. So you can sort of just bring what you want, right? Like you don't have to bring the entire library in. So, Hey,
Starting point is 01:20:10 I wanted to like take a moment to back up. Well, one, this will give Joe an opportunity to find his tip of the week. I already got it, but, uh, Oh,
Starting point is 01:20:18 it wasn't data FNS, but I got, if you're listening, that was hilarious. It'd be so amazing if it was. Um, I'm not sure if you're listening. That was the next slide up there. That's hilarious. It'd be so amazing if it was. And I'm not bombshell. So you asked about the International Time Zone.
Starting point is 01:20:41 So, or not International Time Zone, the International Space Station. So they use Zulu time, which is the same as Greenwich, England. Which is sort of interchangeable with UTC. Well, but again, we're talking about time zone. So they're using that time zone. Okay. So we were right in the time.
Starting point is 01:21:00 But they refer to it as Zulu time, and that's... So if you hear time referenced in zulu that's what they're referencing you know what's interesting about that you remember we were talking about the iso and i never put two and two together but the iso 8601 you remember if you put a time on there and you put z at the end then that's basically that's zero offset i wonder if that's what that represents i assume that the z the z in that case was for zero not zulu i don't know yeah but maybe that's what kind of why they said zulu like uh z
Starting point is 01:21:31 zulu uh zero whatever we're unraveling the mysteries of the well it could be like if you were to think about like you know calling out uh what's the the what the name for letters when you call them out in like the military format like alpha bravo charlie like uh what is the name for letters when you call them out in the military format, like Alpha Bravo, Charlie? What is the name? Z for – I can't remember the name of it, but you know what I'm talking about. Maybe that's why they did use Zulu for Z for zero. Yeah, so it's not confused with a B or a B.
Starting point is 01:21:57 I don't know. I'm speculating at that point, but yeah. Natophenetic alphabet. It just rolls right off the tongue. Yeah, really? I feel like we've really uncovered some deep questions and truths about things in this episode. I feel like the people are going to walk away and go, oh my God, I'm never dealing with dates and times. Give it to the noob. And when they jack it up, we'll blame it on them in like six months.
Starting point is 01:22:25 I kind of think Joe is trolling us. No, I'm still out. Do you ever see that? Oh, whoa, whoa, whoa. We'll back it up. I almost started talking about like TV shows from the 90s that dealt with time zones. Nope. Nope.
Starting point is 01:22:40 Pete and Pete, though. Good episode. You ever see that? Okay, fine. So Pete and Pete, one of the best shows ever, Nickelodeon, two brothers. The kid decides he's going to start riding his bike across the U.S. as the time zone changes in order to extend the best day of the year. So, he takes off in the direction around 2 a.m. and keeps crossing time zones. So, he ends up time traveling.
Starting point is 01:23:05 Oh, that's kind of cool. Yeah. So, I decided not to tell the story because it didn't go anywhere it was just kind of like huh it was an elevator song it was an elevator song everybody's anticipating something that's why i don't know if money was no object then for new year's for your new year's eve party you could just get a plane and fly across the time zones as they're changing, so you could just keep celebrating New Year's Eve, right? That's pretty awesome. Yep. All right.
Starting point is 01:23:31 So the very last thing is we'll have a link here in the show notes that does compare the performance between the Moment.js as well as Date.fns. And it's pretty interesting. Like the, the person who did this put together a nice little set of, you know, diagrams, graphs, charts, all that. Yes.
Starting point is 01:23:54 All those words that alluded me. Um, but yeah, it's pretty words. Words are hard. Dates are hard. So yeah, I mean,
Starting point is 01:24:03 it's worth checking out just to look at it and, you know, maybe help you pick which library you want to use in the future. These are really nice charts. I do want to say, too, like, you know, you got to remember, dear Lister, that we've been talking about dates now for quite a while. We're tired, too, all right? My brain has drained it's done so we have literally just a ton of resource links that you want to check out i assume we'll probably have the same links that we had on the previous episode that you know again just go through and check them out if you have anything that's coming up that you're going to be dealing with dates and times, just know there's nuance. There's a ton of it across every layer of your stack and it's worth knowing
Starting point is 01:24:50 about those. Yeah. I think to kind of sum up quick, it's like if you're storing dates, UTC, if you're working in like a, a.net or JavaScript or a, you know,
Starting point is 01:24:59 whatever Java, like look for a library. That's something like, you know, the letter of first letter of your language plus JA or OTA for a library to use. And yeah, other than that, just know that there's problems in leap seconds and all sorts of weird stuff that makes it difficult for you to do any sort of math on it.
Starting point is 01:25:15 Of course, if you're a SQL developer, then, you know, you're not going to be able to find that library. Nope. Yep. It's absolutely nuts. so with all that said now it's time for my favorite part of the show and we think maybe joe zach's favorite part of the show yeah it's the tip of the week so we've already destroyed three of his tips so we don't know what's about to happen here.
Starting point is 01:25:45 Yeah, so don't knock this one. Come on. Throw me around here. I'm going to throw out our YouTube channel. We've been trying to do a lot of experiments with different kinds of videos out there. And we're trying to get some feedback on what you think of the format. We tried a couple different things. Some of the videos lately have been kind of shorter or have been kind of heavier on editing and just kind of experimenting.
Starting point is 01:26:03 And some things we've got in the works, which will hopefully be published by the time this comes out. And so, you know, if you are looking for something else to watch, give it a shot and let us know what you think. We would really love to have that feedback. And so,
Starting point is 01:26:15 wait, that's not a tip. That was a bad crap. That's fantastic though. Hey, by the way, this is off the cuff here. Yeah,
Starting point is 01:26:24 nevermind. All right, go ahead. Wait, what? No. I was going to say, you know, maybe leave us – now, let's do this. Leave us a comment on this episode about some videos that you'd like to see. Some, you know, what you did like, what you didn't like, you know. It's fine that you can put those comments up on the YouTube videos, but it might be nice to be able to see this in one place, you know, like, Hey, what style did
Starting point is 01:26:48 you like? Um, you know, what content are you interested in seeing up there hearing? And I'll tell you what, if you do that, we'll have a giveaway for our upcoming episodes are going to be going over the pragmatic programmer series or the book. So this will give you a chance to jump in ahead of time. And if you'll leave a comment on here, we'll enter you into the contest to win a copy or two of that. So yeah. Yeah. That's really good.
Starting point is 01:27:14 And I just, I can't resist throwing out my opinions, but I like short videos and I don't like videos with like a lot of coding because I don't want to be looking at trying to read it on my phone so I like more general kind of like higher level type stuff what do you what do you guys like I mean I want there to be enough meat for it to matter and whatever that whatever that it takes to make that happen but I would probably say I'd probably say I don't know I mean because you could have like a really deep uh you know explanation and it'd be like 10 minutes long so would you rather see a video on
Starting point is 01:27:52 like c-sharp uh garbage garbage collection internals or like some technology you know crazy out there machine learning playing you know super mario 3D or something? I mean, well, because I'm kind of thinking about, like, specific to machine learning. Like, there's been some that I've watched where, like, it's a narrow, very narrow topic. So, it can be super deep, but yet it only takes, like, you know, 10, 12, 15 minutes at most. At most. To explain it. You're like, okay know, 10, 12, 15 minutes at most, at most to explain it. You're like, okay, yeah. It's when you get, when you start like expanding the topic that it can like take longer.
Starting point is 01:28:31 Cause it's like, oh, I got to explain this. And I also got to explain this. And I also got to explain this. You know, for me, it's actually, I don't have a preference of one over the other. Like I like to see code where, or videos where people do code but i will say like we've gotten complaints on some of the ones that both you and i have done jozak where they're like dude what resolution did you use yeah are you on a 10k monitor right because they can't see it on the phone so i definitely have gotten to where like I want to watch that stuff on my phone. So I am a little I'm way more aware of having text that's at least legible on the phone or, you know, a smaller form factor.
Starting point is 01:29:13 But like I've definitely there's been times where it's like, hey, I want to learn something about react or how you do something and react. And seeing the code is super helpful. Right. Because they can talk through what they did, where they put it, and all that kind of stuff. So I like that. But I also do like the other ones where it's like, hey, give me the high-level concepts. So I don't think I really have a preference. I like them all.
Starting point is 01:29:34 What I do like, though, and this is what burns me about YouTube and really makes me mad, is if you watch it in a browser, you can't speed it up. If you watch it in the YouTube app, you can. You can speed it up in the browser? No, no, no, on your phone. And actually, in a regular browser, you can't either. No, do it on yours. You can't do it. But if you go to YouTube.com, like an embedded one is what I'm talking about,
Starting point is 01:30:00 like on another website. Not on YouTube.com. If you go to another website and it's embedded, you can't speed it up. And that drives me absolutely bonkers. But if you click on the YouTube logo, then it takes you to the video and you have full control. Because you also, that's not the only limitation that you get in that regard too. Right. Like sometimes you can't change like the quality, you can't maximize it or whatever.
Starting point is 01:30:21 There's all kinds of things that are weird about it. Yeah, that's frustrating. I don't know why they would even like, why they made that a thing. I know. To, like, they limit the options on it. But that's what I will say is, like, I treat my YouTube videos like I do podcasts. Like, I listen to at least 1.5. And then if there's something, like, if I'm trying to go through code and I'm just trying to learn stuff,
Starting point is 01:30:41 then I'll slow it back down and back up and be like, okay, take me through this law or something. But I like it all. I really do. So. Yeah. I mean, I, I definitely, I'm with you on the code thing in the, when I'm watching YouTube videos, I don't, I'm not as big a fan to see that. And it's usually the resolution. Why? But that being said, don't even talk to me about a Pluralsight video if you're not going to show me code. So I don't know why I have that double standard, but I kind of do. Now, I will say I am totally addicted. This is kind of off topic, but when we talk about deep kind of technical things, or not necessarily technical, but deep topics, dives, the TED Talks. I mean, there's just a treasure trove of them on YouTube, and I'm so addicted to them.
Starting point is 01:31:25 I haven't gotten to all of them yet because there's so many, but I'm working on it. Yeah, YouTube's a black hole for me. I mean, straight up. And yeah, I can watch code videos all day, but here's the one thing for me, and this is like it has to hook me. Like somebody can't be completely dry there has to be a little bit of personality there there has to be something that keeps me there right that's the only thing so i don't know okay all right so that was my tip i like it i like it so yes leave a comment on this episode and you'll be entered for it.
Starting point is 01:32:07 You know, let us know what you like in a video, what you'd like to see from our channel specifically. Right. Like that, that would be very helpful to us because we're creating content and we'd like to, you know, for you to enjoy it. And you'll be entered for the chance to win a copy of Pragmatic Programmer. All right. So my tip of the week, this I found in, I think it's just one of those things that I go through. It's like cyclic for me.
Starting point is 01:32:34 You know, every couple of months I'm like, man, I hate NuGet. And it triggers some sort of deep, deep frustration in me. Like, why is this so bad? Why do package managers everywhere else work well, but NuGet doesn't. And it's the one that was adopted by C sharp. Why is that? I don't know. So I think I Googled like alternatives to NuGet. And one that came up is something called packet P A K E T. And I'll have a link to it. And it's interesting. It doesn't solve all the problems with new get,
Starting point is 01:33:10 but it does solve some of them and I'll give them some credit for that. So like one of the things that they mentioned is new get does not separate out the concept of transitive dependencies. I know outlaw you've dealt with this in the past and it is incredibly frustrating, but basically what they mean is they just bundle it. If you have a package or if you have a project that depends on NuGet that depends on other dependencies, it'll roll them all up to that top level packages.config. And you're like, wait a second, but that's not where that dependency is. It kind of, it forces them all for you. And it's like, well, now I don't really know what's using what.
Starting point is 01:33:47 And this sort of solves that they have this packet dot lock file to where it spells all that stuff out. So that's interesting. They also handle versions same, same, same package, different versions and stuff. So they seem to have solved a lot of the problems that NuGet has. I don't know how popular it is, but it was an interesting thing. So I thought I'd share it. Yeah.
Starting point is 01:34:11 And I want to be careful to point out that that's not like, don't confuse it with the book publishing, right? Like not the, what is it? P-A-C-K-T? Oh, I don't know. Do you know the one I'm talking about? Uh-uh. Oh, come on.
Starting point is 01:34:30 You've heard of packet publishing? Oh, packet publishing, yeah. Yeah, I had it right. Is it pact? I always called it pact. Oh, pact. Yeah, I've seen that. P-A, yeah.
Starting point is 01:34:41 Yeah, they do free books every day. If you're in the Slack channel, on the books channel, they have a little message. Cool. Thanks, Harleen. All right. So, with that, it's time for my tip of the week. So, I heard this on, you know, we've talked about My Love of Security Now. And Bleeping Computer, this was mentioned, they referenced an article that bleeping computer had that Chrome and Firefox can take screenshots of sites from the command line. And I've done,
Starting point is 01:35:14 I've definitely done this within Chrome using like an extension. But I've got an example of a command here, but you know, and I'll have a link to the article, but yeah, you could do like whatever your path to Chrome is. I'm just going to forget all that. And we'll just say Chrome EXE,
Starting point is 01:35:31 but you could say Chrome EXE dash dash headless dash dash screenshot and wherever you want to name it. So screenshot equal, like, you know, image dot PNG and it'll take, it'll reach out. It'll launch an instance of Chrome, you won't see a UI for Chrome launch. But you know, a process will be created, it'll go out, reach that web server, render it, and save the image of that screenshot to whatever
Starting point is 01:36:01 location you gave it. And you can specify things like hide the scroll bars. You can say what window size you want it. Like there's a whole bunch of different options that you can give it. And as well as you need to specify the URL. I forgot that part in that. That's really cool. But yeah, I was like, oh man, there's all kinds of like amazing things that you could do with that. Like, because there's definitely been times where I've like wanted to show
Starting point is 01:36:23 somebody something and I'm like, oh, let me go grab some... I want to do a screenshot of this thing, but it's off the screen. This portion is off the screen, so I need some kind of special plug-in or something. And yeah. That's nifty. You could do really long screenshots. I didn't know that. And you can do it with both Chrome and Firefox. Yeah. Which I thought was like super impressive about the article. Cause I'm like, wow,
Starting point is 01:36:49 I could imagine like one of them did, but like they both happened to like sneak it in. That's awesome. Yeah. So, uh, we hope you now have a better appreciation for dates. And,
Starting point is 01:37:04 uh, with that, if you haven't already, subscribe to us on iTunes, Spotify, or Stitcher, or wherever your favorite choice for getting your podcast might be. Be sure to leave us a review if you haven't already. We would greatly appreciate it. You can find some helpful links at www.codingblocks.net slash review. And be sure to share us with a friend too we would appreciate that definitely and while you're up there make sure you check out our extensive show notes examples and more and this one will have a lot of links
Starting point is 01:37:34 and uh send your feedback questions and rants to facebook because we totally have a facebook page and we do stuff there sometimes. You should check it out. I need to turn on notifications for that thing. Oh, and make sure to follow us on Twitter too. Head over to and find those links at the top of the page. Oh, that's amazing.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.