Date formatting in Javascript using date-fns library, nicely illustrated. Thanks, Dom {2024-11-04}
@joel-rg8xm3 ай бұрын
Feedback: Your videos are getting longer and providing less worthy knowledge eventually, I hardly don't stay until the end no more. Sorry to say this. (edit) You did well by putting aside your youtube videos to recharge on inspiration, motivation and worthy content just like you did when you developed custom web components and reusable components back in the day, the topic on your last videos could easily be learned anywhere else. I look forward to your comeback and I hope you are doing well on your current projects, I'm pretty sure you got hired to some bigger projects that set you aside from teaching. (y)
@zoki53883 ай бұрын
title should also mention "using library"
@wesleysandifer6157Ай бұрын
If you want to display seconds (ss) in real time, wrap all this in a function and name it something "function myName() {" At the bottom after the" }", put "setInterval(myName, 1000);" without the quotes.
@tapiomakinen3 ай бұрын
Javascript Date object API is, in my opinion, so rich, that I fail to see the benefit of using (and learning) several-hundred-kilobyte library. Why not just learn the real thing? The reason I comment, is that often I see apps or web pages that download 20 to 30 different libraries, some of which are barely used in the code. If nothing else, it's waste of precious energy and time in the long run. Nothing wrong with the video, though ;)
@Vzome3 ай бұрын
For one reason, I haven't found a good built-in method to format a Date in the current timezone in ISO format.
@tapiomakinen3 ай бұрын
@@Vzome I get your point, it would get a bit cumbersome in this specific case, but maybe this is what you mean: new Date(Date.now()-(60000*new Date().getTimezoneOffset())).toISOString();
@CWhitmer220153 ай бұрын
@@Vzome I tend to agree with @tapiomakien. Lots of folks importing an entire library for a single function. For toISOString() in local time, try creating a new date offset to local time then to toISOString() var tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds var localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1); console.log(localISOTime) // => '2015-01-26T06:40:36.181' The .slice(0,1) is to take the trailing Z off the string as it is not UTC time. Just so it won't be confusing.
@User948Z7Z-w7n2 ай бұрын
That means you haven't used it in enterprise environment. For personal side projects using built in Date object is probably fine. Because who cares about timze zone quirks in a project that nobody uses
@Vzome3 ай бұрын
Nice content, but why use the non-module script tag? Why not just a CDN import directly in your main.js? Use of outmoded global scripts makes me less confident in your content, honestly.