Skip to content

Commit

Permalink
better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DnOberon committed Jan 11, 2023
1 parent 0e70b3c commit 575ebdf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
7 changes: 3 additions & 4 deletions AdminWebApp/src/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
containerExport: 'Export Container',
containerExportDescription: 'Export Container to File',
containerImport: 'Import Container',
containerImportDescription: 'Import Container from File'
containerImportDescription: 'Import Container from File',
},
containerExport: {
pageTitle: 'Export Container to File',
Expand All @@ -119,8 +119,7 @@ export default {
},
containerImport: {
pageTitle: 'Import Container from File',
pageDescription:
"Use this page to import your container and it's various parts from a file that was generated by a previous container export.",
pageDescription: "Use this page to import your container and it's various parts from a file that was generated by a previous container export.",
importOntology: 'Ontology',
importOntologyHelp: 'Imports a new ontology from the supplied container file.',
importDataSources: 'Data Sources',
Expand Down Expand Up @@ -983,7 +982,7 @@ export default {
resultingTypes: 'Metatype/Metatype Relationship/Name',
requiredField: 'Required Field',
dateFormatString: 'Date Format String(blank for ISO)',
dateFormatStringHelp: 'Formatting your date/time',
dateFormatStringHelp: 'Formatting your date/time - if you do not include a timezone, we will assume UTC time.',
selectNodeID: 'Target Node',
selectNodeIDHelp: 'These fields allow you to select which node this time series data should be attached to.',
nodeIDKey: 'Node ID Key',
Expand Down
26 changes: 14 additions & 12 deletions src/domain_objects/data_warehouse/etl/type_transformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,13 @@ export default class TypeTransformation extends BaseDomainClass {
// if it's a number we assume we're dealing with unix time
if (typeof value === 'number') {
try {
const convertedDate = date_conversion_format
? new Date(
(parse(value.toString(), date_conversion_format, new Date()) as any) -
parse(value.toString(), date_conversion_format, new Date()).getTimezoneOffset() * 60 * 1000,
)
: new Date(value);
let convertedDate = date_conversion_format ? parse(value.toString(), date_conversion_format, new Date()) : new Date(value);

convertedDate =
date_conversion_format?.includes('x') || date_conversion_format?.includes('X')
? convertedDate
: new Date((convertedDate as any) - convertedDate.getTimezoneOffset() * 60 * 1000);

return new Conversion({original_value: value, converted_value: convertedDate.toISOString()});
} catch (e) {
return new Conversion({original_value: value, errors: `unable to convert value to date using format string: ${e}`});
Expand All @@ -1002,12 +1003,13 @@ export default class TypeTransformation extends BaseDomainClass {

if (typeof value === 'string') {
try {
const convertedDate = date_conversion_format
? new Date(
(parse(value, date_conversion_format, new Date()) as any) -
parse(value, date_conversion_format, new Date()).getTimezoneOffset() * 60 * 1000,
)
: new Date(value);
let convertedDate = date_conversion_format ? parse(value, date_conversion_format, new Date()) : new Date(value);

convertedDate =
date_conversion_format?.includes('x') || date_conversion_format?.includes('X')
? convertedDate
: new Date((convertedDate as any) - convertedDate.getTimezoneOffset() * 60 * 1000);

return new Conversion({original_value: value, converted_value: convertedDate.toISOString()});
} catch (e) {
return new Conversion({original_value: value, errors: `unable to convert value to date using format string: ${e}`});
Expand Down

0 comments on commit 575ebdf

Please sign in to comment.