Skip to content

Commit

Permalink
handles datetime logic to deal with 1-24hr time (#1057)
Browse files Browse the repository at this point in the history
Co-authored-by: Gabriel Fosse <[email protected]>
  • Loading branch information
majesticio and Gabriel Fosse authored Oct 30, 2023
1 parent 2f9b33d commit c43cf2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/adapters/japan.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ async function getAirQualityData (jpDataUrl) {
);

const result = data.flatMap((row) => {
const dateTimeStr = `${row['年']}-${row['月']}-${row['日']}T${row['時']}:00:00`;
const jstTime = DateTime.fromISO(dateTimeStr, { zone: 'Asia/Tokyo' });
const hour = parseInt(row['時']) - 1;
const dateTimeStr = `${row['年']}-${row['月']}-${row['日']}T${String(hour).padStart(2, '0')}:59:00`;
let jstTime = DateTime.fromISO(dateTimeStr, { zone: 'Asia/Tokyo' });
jstTime = jstTime.plus({ minutes: 1 });

return Object.entries(units)
.filter(
Expand Down

0 comments on commit c43cf2c

Please sign in to comment.