JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Jul 23, 2020 14:46
What I understand here is the way different browsers implement toLocaleString as I get the time without a leading zero in firefox
Jul 23, 2020 14:46
const time = new Date(startDate).toLocaleString('en-US', {
        timeZone: 'America/Los_Angeles,
        hour: '2-digit',
        minute: '2-digit'
      });
Jul 23, 2020 14:45
Hey folks, I am testing function in jest which uses the Date.
while running the test locally, it returns me the time in format 07:00 AM which is expected. And it works in my code also but the same test returns 7:00 AM when these tests are run on jenkins CI pipeline which results in failing tests on CI.
Any idea what could be causing that? The snippet is here
Jul 23, 2020 06:19
What I understand here is the way different browsers implement toLocaleString as I get the time without a leading zero in firefox
Jul 23, 2020 06:15
const time = new Date(startDate).toLocaleString('en-US', {
        timeZone: 'America/Los_Angeles,
        hour: '2-digit',
        minute: '2-digit'
      });
Jul 23, 2020 06:15
Hey folks, I am testing function in jest which uses the Date.
while running the test locally, it returns me the time in format 07:00 AM which is expected. And it works in my code also but the same test returns 7:00 AM when these tests are run on jenkins CI pipeline which results in failing tests on CI.
Any idea what could be causing that? The snippet is here
Jul 21, 2020 13:55
const time = new Date(startDate).toLocaleString('en-US', {
        timeZone: 'America/Los_Angeles,
        hour: '2-digit',
        minute: '2-digit'
      });
Jul 21, 2020 13:55
Hey folks, I am testing function in jest which uses the Date.
while running the test locally, it returns me the time in format 07:00 AM which is expected. And it works in my code also but the same test returns 7:00 AM when these tests are run on jenkins CI pipeline which results in failing tests on CI.
Any idea what could be causing that? The snippet is here
Jul 21, 2020 07:20
const time = new Date(startDate).toLocaleString('en-US', {
        timeZone: 'America/Los_Angeles,
        hour: '2-digit',
        minute: '2-digit'
      });
Jul 21, 2020 07:20
Hey folks, I am testing function in jest which uses the Date.
while running the test locally, it returns me the time in format 07:00 AM which is expected. And it works in my code also but the same test returns 7:00 AM when these tests are run on jenkins CI pipeline which results in failing tests on CI.
Any idea what could be causing that? The snippet is here
Jul 11, 2019 09:35
;)
Jul 11, 2019 09:33
@KarelG Seems like the regex has to be improved :D
Jul 11, 2019 09:28
:D
Jul 11, 2019 09:20
@KarelG LOL correct..but serves my purpose as the product I am building is internal to the organization
Jul 11, 2019 09:14
works well for my purpose
Jul 11, 2019 09:14
/^[a-zA-Z]+(([\'\,\.\-][a-zA-Z])?[a-zA-Z]*)*$/
Jul 11, 2019 09:14
I tried using this
Jul 11, 2019 08:52
Can anyone please help me creating regex for first name and last name. These names should not allow any spaces, special characters or digits.
Really stuck here
Feb 11, 2019 06:14
Facing a weird issue
Feb 11, 2019 06:13
Any React person out there?
Feb 10, 2019 15:08
:)
Feb 10, 2019 15:08
thanks
Feb 10, 2019 15:08
Maybe I will try that and see what happens..I second your opinion though
Feb 10, 2019 15:06
Suppose I have a redux store which contains an array of items, and using that data I do the rendering. Now suppose I sort my array in the redux store....will react re render?
Feb 10, 2019 15:05
:)
Feb 10, 2019 15:05
I will shoot anyways
Feb 10, 2019 15:04
okay one more scenario...if you have worked on redux???
Feb 10, 2019 15:04
Yes have been doing so....hopefully will find the bug
Feb 10, 2019 15:03
:(
Feb 10, 2019 15:03
and have no way of knowing what's causing that under the hood
Feb 10, 2019 15:02
@FélixGagnon-Grenier seems you are correct, but my react-routers are behaving a lil strange
Feb 10, 2019 15:01
does anyone know any tool to see the browser history contents on the fly (real time) while we navigate to different urls
 

Trash can

Like the recycle bin, but trashier.
Jul 21, 2020 07:17
Hey folks, I am testing function in jest which uses the Date.
time = new Date(startDate).toLocaleString('en-US', {
timeZone: 'America/Los_Angeles,
hour: '2-digit',
minute: '2-digit'
});
while running the test locally, it returns me the time in format 07:00 AM which is expected. And it works in my code also but the same test returns 7:00 AM when these tests are run on jenkins CI pipeline which results in failing tests on CI.
Any idea what could be causing that?
 

React.js

this.setState({ status: 'open', description: 'React talk ...' });
Sep 9, 2019 06:28
Any idea what could I be doing wrong
Sep 9, 2019 06:27
I have a group of checkboxes out of which I am trying to highlight a few.
So I am using defaultChecked={true}
The problem here is onChange handler doesn't fire when I uncheck the default checked checkboxes
Jun 3, 2019 06:38
where initialize is an async function and I need to throw the error from within it
Jun 3, 2019 06:38
this.initialize()
.then('something')
.catch('handle error here');
Jun 3, 2019 06:38
something like this
Jun 3, 2019 06:36
I am calling an asynchronus function and from within that function want to throw an error. But I want to handle this error from the catch block of calling function
May 14, 2019 09:55
:D
May 14, 2019 09:55
Thanks for the insight though . @Veljko89
May 14, 2019 09:54
Oh...I thought it's happening because the code is trying to fetch the screenshot even before my webcam is loaded
May 14, 2019 09:39
I am using react-webcam and want to take screenshot of the current webcam image

When I use this.webcam.getScreenshot(); it always returns null. However, when I use a set time out of say 3 seconds, it works and gives me the screenshot
Is there any solution to get this work without the timeout
Mar 27, 2019 08:19
is there any way I can pop an url from the history
Mar 27, 2019 08:17
I want to skip that component when I press forward and move on to the next url
Mar 27, 2019 08:17
Now the default behaviour is if I click forward it will again go to the same component
Mar 27, 2019 08:16
when I go back by clicking the back button I am going to the previous page
Mar 27, 2019 08:16
I am navigating to a component using history.push
Mar 27, 2019 08:15
Facing a challenge related to react routers
Mar 27, 2019 08:15
Hey guys,