« first day (3951 days earlier)      last day (1220 days later) » 

09:58
Morning everyone
@user14601857 Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
is anyone an expert at jest
need some assistance
 
2 hours later…
11:42
Is there any option in `new Date()` to get the current time string like below?
// "5:30 PM" (Not 5:30:00 PM)
Or Splitting that manually is the only option?
@ShubhamPrajapat Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
@ShubhamPrajapat the Date api in vanilla JS is somewhat basic and only has good support for ISO 8601 dates
either you provide that formatting yourself (it is a simple function) or you use an external library to manage your date/time in javascript.
12:40
Why is the answer to Q.2 option D? engineeringinterviewquestions.com/… #SOA
12:53
I wouldn't take a website that has an "about us" that basically (only) summarizes their domain name seriously.
13:48
||> new Date("2021-08-12T17:00:00Z").toLocaleString('en', {timeStyle: "short", hour12: true, timeZone: "UTC"})
@VLAZ '5:00 PM' Logged: [ ] Took: 657ms
@ShubhamPrajapat See the above.
There are various options you can pass to .toLocaleString. If you want really fine control, you can use Intl.DateTimeFormat#formatToParts() and then you can pick and choose certain parts of the date and process them further, if needed. You can discard ones you don't want or tranfrorm some of the ones you do want.
@deostroll Because "service" doesn't need to be a "web service". You can have services that are local to the machine, for example. That discards A and B. C is very weirdly written but carries the same sentiment from another angle - not all "web service" is a "service. Although, with that said, the question is not very good.
 
4 hours later…
17:29
for a header nav do you usually use grid layout, if you want to have a logo centered, another other divs with various widths?
not having much luck with flexbox keeping that logo dead center
@SuperUberDuper that's a bit hard. Flex is meant to have a parent container and that all of its first-level child are being "flexible" towards the parent. You can have it centered, have three child flex containers. Put the logo in the middle one and have your "other divs with various widths" being in those other two containers
using CSS grid may work (and does not require an additional layer of containers) but the problem will be present here as well; if the container right of the logo is too long, it may move up the logo out of its central position
ok, so grid is better?
or i could just make the logo absolute and stick in an empty 100% width div in there
18:27
i always use flex and never grid because i am too lazy to learn grid
19:12
Hello!! SO newbie here. I ran into a comment made by a senior developer on one of my posts and was wondering what you guys think of this. He said (paraphrasing), "Native fetch is better than Axios". Do you feel the same way? If so, why? I thought Axios is more readable and (more importantly) more backward compatible with browsers than fetch. Axios also provides additional features, (like built-in XSRF protection) which can be implemented with fetch but take a ton of work 🤔
@theTerribleSWE Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Can I even ask opinion questions in this chat? I know I cannot on SO :/
@theTerribleSWE You can
@theTerribleSWE I would use fetch unless you have to use axios. I could explain why but it doesn't really matter. In response to your arguments. "Axios is more readable" fetch is very readable imo. "more...compatible" fetch has very good support for any browser is last couple years caniuse.com/?search=fetch, if you need you can use a very small polyfill. " XSRF protection" XSRF/CSRF is pretty easy to implement yourself. I've done quite a few times.
Also you can just avoid using cookies so you don't need to worry about csrf which is easier
19:35
@JBis Ok good to know. Thanks, Josh. Very helpful! I'm going to make fetch my go-to option from now on unless I need to use Axios (then I will use that). I'll let the senior dev know - he wins haha
19:49
IMO, fetch has a few annoying things like a 404 not actually counting as an error. Axios does handle responses a bit less surprisingly. With that said, I'd still personally prefer fetch(). I'd just make it into a very small library that checks if the response was actually successful and if not throw an error.
 
2 hours later…
22:14
@VLAZ I like how it works
404 is an error status but your fetch worked properly
Fetch is only really an error if something fails with the request l
@VLAZ Guided me twice in two days. Thank you! If the 404 error handling gets annoying, I'll make a small library
It's not just 404 - that was an example. All error statuses are not actually returned as errors. So it's easy to write fetch(someResource).then(consumeResource).catch(handleError) and get into trouble because the server decided to return a 500 today. Or perhaps you got a 502. So, the network request succeeded but your code still doesn't cope with it.
Adding .then(result => {if (!result.ok) throw SomeError()}) in many places gets annoying. Hence why I just make a small wrapper that calls fetch and checks the status. I can also uniformly add options (like headers and such) to all requests that way.

« first day (3951 days earlier)      last day (1220 days later) »