Make timezone and unit optional

pull/1732/head
Bishwajyoti Roy 2023-01-06 02:51:17 +05:30
parent 9ee6fb994c
commit 2315397186
No known key found for this signature in database
GPG Key ID: 7010A139AA018DDB
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export default async (req, res) => {
const { id: websiteId, start_at, end_at, unit, tz, url, event_name } = req.query;
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
if ((tz && !moment.tz.zone(tz)) || (unit && !unitTypes.includes(unit))) {
return badRequest(res);
}
const startDate = new Date(+start_at);

View File

@ -33,7 +33,7 @@ export default async (req, res) => {
const startDate = new Date(+start_at);
const endDate = new Date(+end_at);
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
if ((tz && !moment.tz.zone(tz)) || (unit && !unitTypes.includes(unit))) {
return badRequest(res);
}