# Deleting Row in Airtable if the date is on the past

**URL:** <https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151>\
**Category:** Questions about Thunkable X\
**Created:** [December 1, 2022, 10:58am UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151 "2022-12-01T10:58:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurizio.polverini89](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/maurizio.polverini89/32/145191_2.png) [@maurizio.polverini89](https://community.thunkable.com/u/maurizio.polverini89)\
**Post date:** [December 1, 2022, 10:58am UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/1 "2022-12-01T10:58:38Z")

</div>

Hi there,

I’ve been trying to do this:  
That’s an tennis app that allows people to create tennis games. Other players can join the game just by clicking an Item list shown in the app retrieving data from Airtable.

I want that, everyday, this table where all the games are, auto-updates and delete the old games, just keeping the new ones.

This is what i tried

 ![thunkable_support](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41a29afe2207bfec2832bc3739b4a0cc41377d38.png)

The data are shown like this:  
Dec 1, 2022 and Nov 30, 2022 (and they must stay like this)

Everything went smooth until today, apparently it doesn’t recognize the fact the the 30th of November is smaller than the 1st December.

Any ideas on how i can fix this?  
I can make it using the component “seconds since 1970”, adding this information while creating a game, but i’m sure there’s a faster walkaround.

Thank you very much!

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [December 1, 2022, 11:22am UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/2 "2022-12-01T11:22:59Z")

</div>

Seconds since 1970 is the most accurate way to do that.

---

<div class="post-metadata">

**Author:** ![maurizio.polverini89](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/maurizio.polverini89/32/145191_2.png) [@maurizio.polverini89](https://community.thunkable.com/u/maurizio.polverini89)\
**Post date:** [December 1, 2022, 11:44am UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/3 "2022-12-01T11:44:29Z")

</div>

I thought that too, but i’m facing an issue.

A player creates a game when he clicks the button, but the game is set and played further on (might be in the evening or the day after or in two days).

ex.  
I do create a game now at 12.42, 1 Dec 2022 (i can get the seconds from 1970 easily), but i want to play tomorrow.  
The value that I store is 2 Dec 2022 (how can i get this value’s “1970 seconds”?)

Seems tricky and right now i can’t find a proper solution

EDIT:  
i meant, can i extract the “seconds from 1970” component using a date in the future? The component has just the “end” as block.  
From the Date\_Input component based on a date in the future, how can i extract the seconds?

---

<div class="post-metadata">

**Author:** ![maurizio.polverini89](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/maurizio.polverini89/32/145191_2.png) [@maurizio.polverini89](https://community.thunkable.com/u/maurizio.polverini89)\
**Post date:** [December 1, 2022, 12:10pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/4 "2022-12-01T12:10:26Z")

</div>

For now i found a walkaround, accidentally it has deleted all the data on the first time, hopefully it won’t do it again. I’ve been testing and it seems to work good.

Just posting here in case someone in the future will face a similar problem.  
I used the first 3 letters of the Data(the date) that symbolize the month (es. “Nov”). If the month is different from the one we are right now, it automatically deletes the rows.  
I think it might be a solution even tho i’m not sure about it.

 ![thunkable_support](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/1/5198f99df21b7dbad8a88f886e3478b7aa35328a.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 1, 2022, 4:09pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/5 "2022-12-01T16:09:25Z")

</div>

You might consider using Javascript for this:

> **[JavaScript Date Comparison – How to Compare Dates in JS](https://www.freecodecamp.org/news/javascript-date-comparison-how-to-compare-dates-in-js/)**
>
> A date is one of the most common datatypes developers use when creating real-world applications. But often, devs struggle with this datatype and end up using date libraries like Moment.js for simple tasks that aren't worth the large package size...

---

<div class="post-metadata">

**Author:** ![maurizio.polverini89](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/maurizio.polverini89/32/145191_2.png) [@maurizio.polverini89](https://community.thunkable.com/u/maurizio.polverini89)\
**Post date:** [December 2, 2022, 2:01pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/6 "2022-12-02T14:01:59Z")

</div>

Thank you for your help but i’ve no clue on how implement this in my app.  
Literally lost.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 2, 2022, 6:49pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/7 "2022-12-02T18:49:54Z")

</div>

I’m definitely not an expert at Javascript so I might not be the best person to help you but the general idea is to create a script and upload it to your project. Then, you assign the script .html file to the Web Viewer as its url. And finally, you use the Web Viewer message event blocks to send and receive data from the script. I know that’s just an overview… I wish there was a full tutorial on this but I’m not aware of one.

This is a pretty good explanation: [GitHub - thunkable/webviewer-extension: Communicate between the Thunkable Web Viewer and a website](https://github.com/thunkable/webviewer-extension)

And a couple other useful links: [How to send/receive a message using js - #2 by jaythemanchs](https://community.thunkable.com/t/how-to-send-receive-a-message-using-js/1363709/2) and [Date operations (No API) - #3 by muneer](https://community.thunkable.com/t/date-operations-no-api/1355407/3)

@domhnallohanlon I saw an old tutorial video you posted about this process. It would be great to have an updated version!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 2, 2022, 7:08pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/8 "2022-12-02T19:08:55Z")

</div>

Ooh… and @jared has this:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fb199feea4631675ca0f820dd85b004b710683bd.png) [Fun Share: Fun with Date Formatting](https://community.thunkable.com/t/fun-share-fun-with-date-formatting/1681696)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [March 2, 2023, 7:08pm UTC](https://community.thunkable.com/t/deleting-row-in-airtable-if-the-date-is-on-the-past/2159151/9 "2023-03-02T19:08:57Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
