Open martinhalford opened 3 years ago
Hey @jeromesimeon @martinhalford, This issue can be solved by making few changes in dateTimeDrafter function in markdown-transform repo. This may work:
function dateTimeDrafter(value,format) {
if(value){
const f = format ? format : 'MM/DD/YYYY';
return dayjs.utc(value).format(f);
}else{
return "undefined";
}
}
Should I submit a PR to that repo ?
Bug Report 🐛
Details
Consider the following
asset
declaration.As the
DateTime date
variable is optional then a user may, or may not, pass a value in via thedata.json
payload.Example 1
Using the following
data.json
...the
cicero draft
command produces the followingsample.md
...which is as expected.
Example 2
Using the following
data.json
which is missing the optional DateTime attribute, as allowed...the
cicero draft
command incorrectly produces the followingsample.md
...which is not as expected.
Cicero has incorrectly inserted the current date and time values in place of the undefined DateTime attribute.
Expected Example 2
What was expected was...
We'd expect the undefined optional DateTime variable to appear as
undefined
in the output MD files, in the same was as undefined String variables appear asundefined
.Why is this an issue
At the moment, we are unable to distinguish when an optional DateTime variable has been passed in via
data.json
and when an optional DateTime variable has legitimately been omitted.Attached example HelloWorld CTA
helloworld.zip