mirror of
https://github.com/FranP-code/Crypto-Prices.git
synced 2025-10-12 23:53:06 +00:00
Modularizated API Calls
This commit is contained in:
16
src/components/Crypto/API calls/getDates.js
Normal file
16
src/components/Crypto/API calls/getDates.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import moment from "moment"
|
||||
|
||||
const getDates = (days) => {
|
||||
|
||||
let result = []
|
||||
|
||||
for (let i = 0; i < days; i++) {
|
||||
|
||||
const day = moment().subtract(i, 'days').format('DD-MM-YY')
|
||||
result.push(day)
|
||||
}
|
||||
|
||||
return result.reverse()
|
||||
}
|
||||
|
||||
export default getDates
|
||||
Reference in New Issue
Block a user