This script pictured below properly inserts the Date retrieved into a Date field as long as I run it before a certain time. If I run it in the morning, for example, I get the date I expect in my Date field. I just ran this at 6:50pm in my current timezone and it entered the date into the date field as if it were a day later:
I do not have the Time included in this Date field, and I do not have the “Use the same timezone for all…” option checked:
Does anyone know how I can ensure my dates are entered accurately relative to my timezone, or even regardless of timezone (since I am not interested in the time anyways)? Any Airtable dev’s able to help?
toString() version to the console again to see what would happen. (Top line is before posting to the field; bottom line is after retrieving it from the same field.)
I then converted the field to show the time (GMT disabled)…
I then ran my test script again. Now the field matches my local date and time, but look at the time spit out for the retrieved version. Still 7-22 like it was last time, but it’s exactly 7 hours ahead of my local time. In other words, the time retrieved is relative to GMT even though the field isn’t formatted to show it that way.
And now when I convert the field back to be date only, it keeps the last date that it had: 7/21.
I tested the suggestion from @Kamille_Parks, and the date stayed “local” after sending it to the field.
I’ll run the same test tomorrow morning and see what happens.
Good news! That fix that @Kamille_Parks posted does work at multiple times of day. I ran the same script just now, and it shows the correct date. What I found especially interesting with this workaround is that when the time option is active for the field, the time no longer becomes my local time, but it stays at 12am.
I ran into this while trying to sync a base with another, the column type was lost (date) and I was trying to copy the field value from a text column into a datetime column.
So far no luck, it’s not accurate. I believe it’s easier to copy the value as text into a text field and then run
DATETIME_PARSE formula on another field to get it right.