mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +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:
@@ -109,6 +109,22 @@ describe('Data Transformation Functions', () => {
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
test('.diffTo() should work with a single unit', () => {
|
||||
expect(
|
||||
evaluate(
|
||||
"={{ '2025-01-01'.toDateTime().diffTo('2024-03-30T18:49:07.234', 'days').floor() }}",
|
||||
),
|
||||
).toEqual(276);
|
||||
});
|
||||
|
||||
test('.diffTo() should work with an array of units', () => {
|
||||
expect(
|
||||
evaluate(
|
||||
"={{ '2025-01-01T00:00:00.000'.toDateTime().diffTo('2024-03-30T18:49:07.234', ['months', 'days']) }}",
|
||||
),
|
||||
).toEqual({ months: 9, days: 1.2158884953703704 });
|
||||
});
|
||||
|
||||
describe('toDateTime', () => {
|
||||
test('should return itself for DateTime', () => {
|
||||
const result = evaluate(
|
||||
|
||||
Reference in New Issue
Block a user