The Easiest Way to Format Dates in JavaScript

  Рет қаралды 1,580

dcode

dcode

Күн бұрын

Пікірлер
@Pareshbpatel
@Pareshbpatel 2 ай бұрын
Date formatting in Javascript using date-fns library, nicely illustrated. Thanks, Dom {2024-11-04}
@joel-rg8xm
@joel-rg8xm 3 ай бұрын
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)
@zoki5388
@zoki5388 3 ай бұрын
title should also mention "using library"
@wesleysandifer6157
@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.
@tapiomakinen
@tapiomakinen 3 ай бұрын
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 ;)
@Vzome
@Vzome 3 ай бұрын
For one reason, I haven't found a good built-in method to format a Date in the current timezone in ISO format.
@tapiomakinen
@tapiomakinen 3 ай бұрын
@@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();
@CWhitmer22015
@CWhitmer22015 3 ай бұрын
@@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-w7n
@User948Z7Z-w7n 2 ай бұрын
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
@Vzome
@Vzome 3 ай бұрын
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.
Two Easy Ways to Compare Dates in JavaScript
8:17
dcode
Рет қаралды 1,3 М.
There's Way More to JSON.Stringify Than You Think
9:26
dcode
Рет қаралды 3,1 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 945 М.
OAuth 2.0 and OpenID Connect (in plain English)
1:02:17
OktaDev
Рет қаралды 1,8 МЛН
SilverBullet: The one about Space Lua
39:40
Zef Hemel
Рет қаралды 411
Learn flexbox the easy way
34:04
Kevin Powell
Рет қаралды 740 М.
5 JavaScript Console Methods Every Developer Should Know
8:23
UV and Ruff: Next-gen Python Tooling
56:54
Matt Layman
Рет қаралды 7 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
3 Ways to Remove From Arrays in JavaScript
8:00
dcode
Рет қаралды 992
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН