Skip to content

Get local time and update sensor_readings to UTC tz#228

Open
kfazinic wants to merge 2 commits into
developfrom
fix/timezone-sensor-readings
Open

Get local time and update sensor_readings to UTC tz#228
kfazinic wants to merge 2 commits into
developfrom
fix/timezone-sensor-readings

Conversation

@kfazinic
Copy link
Copy Markdown
Member

@kfazinic kfazinic commented Apr 28, 2020

Note: need to run db:clean and db:setup locally and on the production DB after merging.

const [date, time] = datetime.split('T');
const datetimeTag = `${date}/${month} ${time}h`;
const [year, month, day] = date.split('-');
const datetimeTag = `${day}/${month} ${time.slice(0, 2)}h`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use moment for formatting the date? (Excepts that it was not used before)

Comment thread src/server/knexfile.js
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
dateStrings: true,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do? Force the DB to return strings? Why is that necessary? I would think it would be better to keep dates as timestamps for as long as possible and only render them into strings in the presentational components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants