Different results using Checkbox vs Button to update text field with today() using the exact same code
I was having an issue with dates not storing correctly with some of my code. The code was storing dates as the next day instead of current day. While trying to figure out where my problems were coming from, i setup a checkbox and a button with the EXACT same code. Either onUpdate or onClick my test text field should be populated with today's date. Instead I get this outcome:
- Checkbox Outcome - when clicked it adds 1 day to the current day and puts that in the text field.
- Button outcome - when clicked it fills the text field with the correct date.
Here is the code I used on both button & checkbox
'date test 2' := format(today(), "MM/DD/YY");
'date test 3' := today()
I also included a formula field that simply displays today's date using "today()". It displays the correct date.
"date test 2" field = type is "TEXT".
"date test 3" field = type is "DATE".
Any ideas on why this occurs? It's reminiscent of the timezone issue that Ninox had/has.
7 replies
-
are you using the Cloud version?
testing on the MacOS, I don’t see the problem.
When I use a button or Trigger on Update to modify a date field it works with:
Date := today()
It doesn’t work if I use:
Date := format(today(),"MM/DD/YY")
It sets the date as Jan 20 2020.
If I write to a text field the above works.
Can you post a sample of your DB?
-
yes, the cloud version.
-
It's 10:26am here in California - I clicked the checkbox and it shows the correct date. I'm going to try it again later today and see what it does. To see if timezone is playing a part. Regardless, I don't see any reason that a checkbox or button should have yielded different results with the exact same code.
-
It is 4:08 pm and when I click the checkbox it is now showing the wrong date ie increasing the day by one. Again, this feels a lot like the timezone issue Ninox has had for a long time. But usually I only experienced that with team members not in my own timezone.
Maybe I don't have enough skilled knowledge but this feels like a bug since a button with the same code works and the checkbox does not. -
It may have something to do with the execution of the triggers i guess.
https://docs.ninox.com/en/script/appendix/transactions/execution-context
Not sure if a trigger of a checkbox is executed on the server or the button does? (in any case, one is different from the other so it seems...)
I'll have to check the source code of Ninox to know but I don't have the extended JS knowledge like Jacques TUR to check this out.
Content aside
- 1 yr agoLast active
- 7Replies
- 171Views
-
4
Following