(core) Set DateTime timezone during xlsx import

Summary:
DateTime columns had a blank timezone after xlsx imports because the
timezone was not included in the column type. We now append the
document's timezone to the type of all imported DateTime columns.

Test Plan: Server test.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3896
This commit is contained in:
George Gevoian
2023-05-23 22:53:20 -04:00
parent d5b8240c07
commit ff03d32688
3 changed files with 19 additions and 0 deletions

View File

@@ -98,6 +98,14 @@ export function formatRelBounds(periods: IPeriod[]): string {
);
}
/**
* Returns a new timestamp that is the UTC equivalent of the original local `timestamp`, offset
* according to the delta between`timezone` and UTC.
*/
export function localTimestampToUTC(timestamp: number, timezone: string): number {
return moment.unix(timestamp).utc().tz(timezone, true).unix();
}
function formatDay(quantity: number, refUnit: IPeriod['unit']): string {
if (refUnit === 'week') {