Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
fix(historical-data): fix date-fns format
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Sep 9, 2019
1 parent 5e38b00 commit 8a4b6a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions historicalData/concatenateRawDeviceMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ export const handler = async () => {
// Concatenate hours
await concatenateFiles({
Prefix: 'raw/updates/',
notAfterDate: dateFns.format(new Date(), 'YYYY-MM-DDTHH'),
notAfterDate: dateFns.format(new Date(), "yyyy-MM-DD'T'HH"),
fileNameToDate: filename => {
const [date] = path.parse(filename).name.split('-')
const m = dateRx.exec(date)
if (m) {
const [, year, month, day, hour] = m
return `${year}-${month}-${day}T${hour}`
}
return dateFns.format(new Date(), 'YYYY-MM-DDTHH') // No date found
return dateFns.format(new Date(), "yyyy-MM-DD'T'HH") // No date found
},
dateToFileName: date => `hours/${date}.txt`,
})
// Concatenate days
await concatenateFiles({
Prefix: 'hours/',
notAfterDate: dateFns.format(new Date(), 'YYYY-MM-DD'),
notAfterDate: dateFns.format(new Date(), 'yyyy-MM-DD'),
fileNameToDate: filename => {
const [year, month, day] = path
.parse(filename)
Expand All @@ -140,7 +140,7 @@ export const handler = async () => {
// Concatenate months
await concatenateFiles({
Prefix: 'days/',
notAfterDate: dateFns.format(new Date(), 'YYYY-MM-01'),
notAfterDate: dateFns.format(new Date(), 'yyyy-MM-01'),
fileNameToDate: filename => {
const [year, month] = path.parse(filename).name.split('-')
return `${year}-${month}-01`
Expand Down

0 comments on commit 8a4b6a7

Please sign in to comment.