Change date with button

122 views
Skip to first unread message

Aly IGERY

unread,
Mar 27, 2026, 6:52:03 AM (11 days ago) Mar 27
to mementodatabase
Hello everyone…

I've searched the forum but haven't found anything helpful.

We have two requests…

1. In our library named "ITT" (IsTimeTracker), we have two date fields with start and end dates, "Start" and "End", in the format "dd.MM.YYYY, hh:mm:ss". We want to use a button to increment only the day, e.g., today being the 26th, would only be 27th when the button is clicked. Does anyone know the corresponding code?

2. …and there are also some fields that we would like to be visible only when creating or editing an entry, and invisible after saving. Is this possible?

Mmm

unread,
Mar 27, 2026, 8:24:08 AM (11 days ago) Mar 27
to mementodatabase
Шаблон с примером в каталоге шаблонов:
пятница, 27 марта 2026 г. в 13:52:03 UTC+3, warna...@gmail.com:
IC__27032026.jpg

Aly IGERY

unread,
Mar 27, 2026, 9:58:46 AM (11 days ago) Mar 27
to mementodatabase
It works. Thank you very much. 👏👏👏

David Gilmore

unread,
Mar 28, 2026, 10:43:51 AM (10 days ago) Mar 28
to mementodatabase
Your second question is separate from the first.  May I suggest you create a separate thread for that question, so that others can easily find it when searching for this answer.

I do have a solution for you, which I use in most of my libraries, and which I will share in the new thread.

For the first question, there a many ways to accomplish this. If you want to do this in simple Javascript, the following works:

var e = entry();
var dt = new Date(e.field("DateField"));
dt.setDate(dt.getDate() + 1);
e.set("DateField", dt.getTime());

The above still works when at the end of the month or year.

 One advantage with using Javascript is that it adds flexibility when/if your requirements change.

Aly IGERY

unread,
Mar 28, 2026, 6:57:53 PM (10 days ago) Mar 28
to mementodatabase
Hi David,

Thank you for your attention.

I've solved question 2.

Your code works well. I can even use it for two date fields.

Thanks again! 👍👍👍

Aly IGERY

unread,
Mar 29, 2026, 3:52:35 AM (10 days ago) Mar 29
to mementodatabase
I copied and edited part of the code to change two dates simultaneously. Now I want to add a second button below to change the date by one month. How do I need to modify the code?

Have a nice day!

Mmm

unread,
Mar 29, 2026, 4:05:55 AM (10 days ago) Mar 29
to mementodatabase
Например, с помощью 

moment().add(1, 'M');

воскресенье, 29 марта 2026 г. в 10:52:35 UTC+3, warna...@gmail.com:

Aly IGERY

unread,
Mar 29, 2026, 4:28:07 AM (10 days ago) Mar 29
to mementodatabase
Thanks "Mmm". That's great.

But I'm confused, where am I supposed to insert your code? (I mean at the top of "David's" code)

Mmm

unread,
Mar 29, 2026, 4:56:33 AM (10 days ago) Mar 29
to mementodatabase
Про Date():
Чтение и установку дня нужно заменить на чтение и установку месяца...

воскресенье, 29 марта 2026 г. в 11:28:07 UTC+3, warna...@gmail.com:

Aly IGERY

unread,
Mar 29, 2026, 5:02:50 AM (10 days ago) Mar 29
to mementodatabase
Это гораздо полезнее и интереснее.

Хорошего дня… 👍👍👍

David Gilmore

unread,
Mar 29, 2026, 10:02:42 AM (9 days ago) Mar 29
to mementodatabase
var e = entry();
var dt = new Date(e.field("DateField"));
dt.setMonth(dt.getMonth() + 1);
e.set("DateField", dt.getTime());

As I said, Javascript flexibility. If you want to learn more about native Javascript date functions, search for "javascript date object".

Aly IGERY

unread,
Mar 29, 2026, 11:01:32 AM (9 days ago) Mar 29
to mementodatabase
Very nice, David.

Thank you and have a nice day. 👍👍👍
Reply all
Reply to author
Forward
0 new messages