23 Replies
i am currently doing this
alternatively you can do:
but yours seems to work as well
react saying setDate is not a function
can you show the code you're using then?
cause
Date.setDate
is part of the spec for the default Date object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setDateokay got it working
i did this
Date stamps are in milliseconds, so just:
1000ms per sec, 60s per min, 60m per hour, 24h per day, 7d per week
Simple maths š
that might break around DST
there's about two hours a year where that could give you the wrong day
Well, fine, be that way lol
š
yours is fine for 99.99% of cases, but if
setDate(lastWeekDate.getDate() - 7)
doesn't work, then it's a bug in the engine, not your code šI like passing blame, yes
Ship it!
i want to achieve this:
Week wise issue count (upto last 10 weeks)
i have got the issues
how can sort them on the ui up to last 10 weeks
so basically i want to show how many issues are/were per week
upto 10 weeks
how do you store your issues?
i have fetched them, now there are like this:
[100 issues] -> {issue.created_at}
i hope u get this
of hows the hierarchy
you could use
Array.filter
to get only the ones you want. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filterwow, i thought u were writing something big
š
got distracted š
can u help me in this task?
I'll try to take a look tomorrow, it's very late here. Very globally, you'd want to use the method I linked on the array, to filter out any issues you don't want.
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
that looks like a nice library
for filtering your issues, @curator, you could use
isWithinInterval
https://date-fns.org/v2.29.3/docs/isWithinInterval to determine if the issue's creation date is within the week you're looking at, and the subDays
function Leon linked to create the two reference points. Something like:
can i dm u?
no thanks
if you have any questions you can ask them here, so that if anyone else ever needs this info, they can find it
I'm glad to keep helping, but it's better for you too to keep it in the thread here so others can help too! @curator
yes agreed