Skip to content

Commit

Permalink
fix: Do not fail extractDate on missing result set
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Dec 23, 2023
1 parent bcc1a89 commit c8567ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cubejs-backend-shared/src/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ export const utcToLocalTimeZone = (timezone: string, timestampFormat: string, ti
return moment.tz(timestamp, 'UTC').tz(timezone).format(timestampFormat);
};

export const extractDate = (data: any): string => {
export const extractDate = (data: any): string | null => {
if (!data) {
return null;
}
data = JSON.parse(JSON.stringify(data));
const value = data[0] && data[0][Object.keys(data[0])[0]];
if (!value) {
Expand Down

0 comments on commit c8567ef

Please sign in to comment.