Help

Blanking out Date type field

Topic Labels: Scripting extentions
Solved
Jump to Solution
1530 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Bizarrebra
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,

I’m struggling with setting correctly a Date field. Basically I have a field with Date type which I set to Date.now() when something happens. If anything else happens I want to blank out the field and leave it emtpy. If I try…

myDate = null;

I get an error reading “Type ‘null’ is not assignable to type ‘number’”, and it seems the only way I can get rid of the error is by using…

myDate = 0;

Now, when I run the script and my “else” is executed I can’t seem to assign 0 to the field, and I’m getting an error reading “j: Can’t set cell values: invalid cell value for field ‘myDate’.
Cell value has invalid format: .0 must be a string, .1 must be a string, .2 must be an object

So, the question: how can I manually assign null/empty to a Date field so that no value is displayed?

Thanks in advance for your help.

1 Solution

Accepted Solutions

Your errors say the format must be a string, and the documentation says Date fields accept strings.

Trust your own eyes, our opinions aren’t going to give your field a value if you have observed it to be blank.

See Solution in Thread

2 Replies 2
Bizarrebra
5 - Automation Enthusiast
5 - Automation Enthusiast

Wow, trying a very simple thing seemed to work:

myDate = "";

Is it possible that it is so simple as to insert a blank string? Can anybody with more experience confirm, please? I mean, my field now appears blank, but I’d rather have a second opinion.

Thanks!

Your errors say the format must be a string, and the documentation says Date fields accept strings.

Trust your own eyes, our opinions aren’t going to give your field a value if you have observed it to be blank.