Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(route): qweather/now timezone #9431

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/v2/qweather/now.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const got = require('@/utils/got');
const { art } = require('@/utils/render');
const path = require('path');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const config = require('@/config').value;
const rootUrl = 'https://devapi.qweather.com/v7/weather/now?';
module.exports = async (ctx) => {
Expand All @@ -26,9 +27,9 @@ module.exports = async (ctx) => {

const data = [responseData.now];

const timeObj = parseDate(responseData.updateTime);
const timeObj = timezone(parseDate(responseData.updateTime), +8);

const time_show = timeObj.getFullYear() + '-' + timeObj.getMonth() + '-' + timeObj.getDay() + ' ' + timeObj.getHours() + ':' + timeObj.getMinutes();
const time_show = timeObj.toLocaleString();

ctx.state.data = {
title: ctx.params.location + '实时天气',
Expand Down