mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +00:00
feat(editor): Add examples for Luxon DateTime expression methods (#9361)
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -73,18 +73,23 @@ export class Expression {
|
||||
*
|
||||
*/
|
||||
convertObjectValueToString(value: object): string {
|
||||
const typeName = Array.isArray(value) ? 'Array' : 'Object';
|
||||
|
||||
if (value instanceof DateTime && value.invalidReason !== null) {
|
||||
throw new ApplicationError('invalid DateTime');
|
||||
}
|
||||
|
||||
let typeName = value.constructor.name ?? 'Object';
|
||||
if (DateTime.isDateTime(value)) {
|
||||
typeName = 'DateTime';
|
||||
}
|
||||
|
||||
let result = '';
|
||||
if (value instanceof Date) {
|
||||
// We don't want to use JSON.stringify for dates since it disregards workflow timezone
|
||||
result = DateTime.fromJSDate(value, {
|
||||
zone: this.workflow.settings?.timezone ?? getGlobalState().defaultTimezone,
|
||||
}).toISO();
|
||||
} else if (DateTime.isDateTime(value)) {
|
||||
result = value.toString();
|
||||
} else {
|
||||
result = JSON.stringify(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user