From d9e7202e3b1d6a86047fcf67f8ee78c625e2fe68 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Mon, 22 Apr 2024 07:10:00 +0100 Subject: [PATCH] wip --- .../subjects/DatesAsNumbers.svelte | 16 +++-- .../subjects/NumbersAsDates.svelte | 57 +++++++++++++++- .../subjects/StringsAsDates.svelte | 65 +++++++++++++++++-- 3 files changed, 123 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/DatesAsNumbers.svelte b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/DatesAsNumbers.svelte index 4921ac5823..e920395672 100644 --- a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/DatesAsNumbers.svelte +++ b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/DatesAsNumbers.svelte @@ -24,26 +24,32 @@
- A date can be used in place of a numeric value, but it will be converted to a UNIX time timestamp, which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number. + A datetime value can be used in place of a numeric value, but it will be converted to a UNIX time timestamp, which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number.
- 1st Jan 2000: 946684800000 + + {(new Date(946684800000).toLocaleString())} + + {"->"} 946684800000 - 1st Jan 2020: 1577836800000 + + {(new Date(1577836800000).toLocaleString())} + + {"->"} 1577836800000 - Now: {timestamp} + Now{"->"} {timestamp}
diff --git a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/NumbersAsDates.svelte b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/NumbersAsDates.svelte index b3bf785afc..f448a376d2 100644 --- a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/NumbersAsDates.svelte +++ b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/NumbersAsDates.svelte @@ -1,9 +1,60 @@ - -
-
+ +
+ A number value can be used in place of a datetime value, but it will be parsed as a UNIX time timestamp, which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number. +
+ + + + 946684800000 + {"->"} + + {(new Date(946684800000).toLocaleString())} + + + + 1577836800000 + {"->"} + + {(new Date(1577836800000).toLocaleString())} + + + + {timestamp} + {"->"} + Now + + +
diff --git a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/StringsAsDates.svelte b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/StringsAsDates.svelte index 3effc88640..af1336c28a 100644 --- a/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/StringsAsDates.svelte +++ b/packages/builder/src/components/design/settings/controls/Explanation/DetailsModal/subjects/StringsAsDates.svelte @@ -3,13 +3,13 @@ import { ExampleSection, ExampleLine, Block, Subject, Section } from './components' let timestamp = Date.now(); + $: iso = (new Date(timestamp)).toISOString(); onMount(() => { let run = true; const updateTimeStamp = () => { timestamp = Date.now(); - console.log(timestamp); if (run) { setTimeout(updateTimeStamp, 200) } @@ -23,28 +23,79 @@ }) - +
- A date can be used in place of a numeric value, but it will be parsed as a UNIX epoch timestamp, which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number. + A string value can be used in place of a datetime value, but it will be parsed as: +
+
+ A UNIX time timestamp, which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number.
- 1st Jan 2000: 946684800000 + 946684800000 + {"->"} + + {(new Date(946684800000).toLocaleString())} + - 1st Jan 2020: 1577836800000 + 1577836800000 + {"->"} + + {(new Date(1577836800000).toLocaleString())} + - Now: {timestamp} + {timestamp} + {"->"} + Now +
+ An ISO 8601 datetime string. which is the number of milliseconds since Jan 1st 1970. A more recent moment in time will be a higher number. +
+
+ + + 2000-01-01T00:00:00.000Z + {"->"} + + {(new Date(946684800000).toLocaleString())} + + + + 2000-01-01T00:00:00.000Z + {"->"} + + {(new Date(1577836800000).toLocaleString())} + + + + {iso} + {"->"} + Now + + +
+