These are chat archives for FreeCodeCamp/Help

19th
Jan 2019
Kaz Baig
@kbaig
Jan 19 00:13
@josepagan d3 just does so much. Usually your case needs something more specific
Sometimes the solutions you choose instead use d3, which could be fine
Angel
@angelparkour499
Jan 19 03:42
Hi guys
I was wondering
How can i make a carousel that i can interact with
Like
If you click on a part of the carousel it takes you some place and if you click on other part, it takes you to a different place
ehutchllew
@ehutchllew
Jan 19 03:49
@angelparkour499 What about creating a container that has children components that are transparent. The container has the background image url, and the children have the click/press events.
Angel
@angelparkour499
Jan 19 03:50
How can i put a click/press event on it? bro
abraham anak agung
@padunk
Jan 19 04:31
@angelparkour499 you mean your carousel interact like a link?
Angel
@angelparkour499
Jan 19 05:30
Yes
Daniel Simeonov
@dbsimeonov
Jan 19 12:07
Guys been struggling with sorting an array with Time strings for a while and all the methods I've tried to do that manually have failed me...
I've got them in this syntax 2018-11-30T15:20:40Z
Tried to remove the non number characters, and reverse them in normal way - dd/mm/yyyy but failed there, also need to sort the ones that are Upcoming from todays date in separate Array, any tips?
problem is that I can not use plugins in that case too..
ehutchllew
@ehutchllew
Jan 19 12:40
@dbsimeonov have you looked at the Date api? I'm pretty sure you can use JS's Array.prototype.sort and compare the values of each by first converting them using something along the lines of: let aDate = new Date('2018-11-30T15:20:40Z')
@dbsimeonov I had to implement a similar feature in one of our products not long ago, I believe that was how I went about it. As for your 2nd point regarding sorting upcoming dates, just use a conditional to check them like: if(upcomingDate > new Date())
You might want to instantiate a new Date() object prior to the if expression, but when you instantiate it without any constructor arguments it just creates a date with the "now" - or current - time.
Daniel Simeonov
@dbsimeonov
Jan 19 12:43
@ehutchllew I didn't know I can change the data with New Date(var), thanks a lot. Really third time Im doing similar project and each time I have issues with those Dates.. thanks!
ehutchllew
@ehutchllew
Jan 19 12:44
Yeah no problem, you don't need any RegEx for this, JS can handle the date comparison.
Let me know if that works or needs some slight tweaking.
Jose Pagan
@josepagan
Jan 19 12:44
I am not sure if it suits your needs, I havent followed the fcc challenges in a while but, would not convert the date to millisecond help
using Date.parse(timestring)
ehutchllew
@ehutchllew
Jan 19 12:45
You could do that, but not necessary.
I'm pretty sure when you sort, add, subtract, etc. on a Date string it is essentially comparing its bytes/integers, so converting to milliseconds first is redundant.
At least I think that's what is happening, I could be wrong!
Daniel Simeonov
@dbsimeonov
Jan 19 13:11
Is this one a date?
1561453200
It gives me 1970s but it should be 2019 :D
this API doesn't give me any information or docs...
probably I need to multiply it by something ?
ehutchllew
@ehutchllew
Jan 19 13:45
Where is it coming from? Did you convert a date to seconds?
Jose Pagan
@josepagan
Jan 19 16:13
hi I am starting to play around with react, is it perfectly fine to copy a folder made with create-react-app instead of generating in each time?
ehutchllew
@ehutchllew
Jan 19 16:47
@josepagan The base application? Yeah, but if you're not running CRA periodically on new projects, you won't be getting the new versions of React.
Jose Pagan
@josepagan
Jan 19 16:48
@ehutchllew thanks!
ehutchllew
@ehutchllew
Jan 19 16:56
np
Christopher McCormack
@cmccormack
Jan 19 17:55
@dbsimeonov I know it's late but you're missing like 3 digits from that, so it doesn't have enough information for the year.
Compare:
new Date(1561453200)
> Sun Jan 18 1970 18:44:13 GMT-0700 (Mountain Standard Time)
new Date(Date.now())
> Sat Jan 19 2019 10:55:00 GMT-0700 (Mountain Standard Time)
Date.now()
> 1547920508666
Daniel Simeonov
@dbsimeonov
Jan 19 17:56
I had to multiple it by 1000
and thanks
Christopher McCormack
@cmccormack
Jan 19 17:56
np
Niraj Nandish
@Nirajn2311
Jan 19 18:35
@cmccormack new Date does with relative to that 000 thing right?
Christopher McCormack
@cmccormack
Jan 19 18:36
Not following @Nirajn2311 , not sure why @dbsimeonov had to add those
Niraj Nandish
@Nirajn2311
Jan 19 19:32
@cmccormack meant that the numbers inside the bracket of new Date are relative to some standard time?
Christopher McCormack
@cmccormack
Jan 19 19:33
it's just the time in milleseconds since the epoch date
which I believe is Jan 1 1970
Niraj Nandish
@Nirajn2311
Jan 19 19:44
That's the date I was looking for
I don't know the name 😂
May Kittens Devour Your Soul
@diomed
Jan 19 21:07
@Nirajn2311 is probably sleeping by now