how to use new fuction sync with google calendar

261 views
Skip to first unread message

Jorge Luis

unread,
Nov 26, 2025, 1:33:43 PM11/26/25
to mementodatabase
I'm trying to use the new Memento Database feature to sync with Google Calendar, but I've already completed the first step of exporting menu, LInk and I don't know what to do next to make them appear in the calendar.


Screenshot_2025-11-26-11-32-59-818_com.luckydroid.droidbase.jpg

Simon Hall

unread,
Dec 6, 2025, 3:14:05 AM12/6/25
to mementodatabase
I can't seem to get this to work at all. The relevant library has both a date field and a time field.
When I go to Import & Export the only option I get are Link to Google Sheets, Import & Export, Send All.
If I select Import & Export the options are Import from CSV, Export to CSV.
The Link to Google Calendar option doesn't appear at all
Am I missing something?

Jorge Luis

unread,
Dec 6, 2025, 10:41:33 AM12/6/25
to mementodatabase
The field has to be "Date/time" no separated

Simon Hall

unread,
Dec 6, 2025, 11:40:39 AM12/6/25
to mementodatabase
Thanks Jorge
Though this is NOT what it says in the Memento help articles.
So the question becomes.... how can I merge my current Date and Time fields into a single Date/Time Field
Regards

Message has been deleted

Jorge Luis

unread,
Dec 6, 2025, 12:29:58 PM12/6/25
to mementodatabase
MAybe you dont have the BETA version

In fact, even if the database has a date field, the option to sync with Google Calendar should appear.

memento 5.8.0 BETA

Simon Hall

unread,
Dec 6, 2025, 12:42:56 PM12/6/25
to mementodatabase
No I don't. Again there is no mention in the help that this is only in BETA. I'll wait until the full release

David Gilmore

unread,
Dec 6, 2025, 1:35:21 PM12/6/25
to mementodatabase
You did not get an answer to that indirect question on how to merge a separate date and time Memento fields into a combined datetime field. Actually you will find that date fields often will have a time setting as well, just ignored. The same with a time field.

But to merge those two fields:

ver e as entry();
var ddate = new Date(e.field("datefield"));
ver dtime = new Date(e.field("timefield"));
ddate.setHours(dtime.getHours(), dtime.getMinutes(), dtime.getSseconds(), dtime.getMilliseconds());
e.set("datetimefield", ddate.getTime());

Simon Hall

unread,
Dec 25, 2025, 3:31:40 AM12/25/25
to mementodatabase
Thanks for the info on combining these fields but I'm afraid that I know nothing about Javascript so cannot see how to apply your suggestion to my particular library 'Pub Visits'
I have a Date field called 'Date' , a Time field called 'Time (or index)' and I have created a new Date/Time field called 'Date / Time'
All I need is a bit of script to run once through the entire library (33,000+ records) to populate the new field from the two previous ones (which can sometimes contain no data)
Thanks in advance for any help

Bill Crews

unread,
Dec 25, 2025, 7:23:29 AM12/25/25
to Simon Hall, mementodatabase
A Date field value is an absolute number of milliseconds since the midnight hour (milliseconds, actually) preceding January 1, 1970. If it's a minus number, the date can you far back into the past.

A Time field value is a number of milliseconds since the starting millisecond of the current day.

You say once h through all the records. I'm Memento, that would normally mean a library action script (JavaScript) wherein the trigger is run after saving the entry.

So, adding a date to a time gives you the DateTime of that mement.

So, in defining such an action, the following script should suffice...

let lib = lib();
let entries = lib.entries
for e of entries {
    e.set("DateTime", e.field("Date")
    + e.field("Time"));
}

I recommend caution in using special characters in field names. They may normally work, but then they may not, and the difficulty is often hard to discover.


--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mementodatabase/459ee5d2-dbb1-40b9-92c5-3694fe870b3an%40googlegroups.com.

David Gilmore

unread,
Dec 25, 2025, 10:43:29 AM12/25/25
to mementodatabase
Sorry Bill, but summing the two raw values will not always give you an accurate result.

Memento has a bad habit of putting/adding a time offset value into a Date only field, which Memento will simply ignore later. That is why simply adding the raw date value and time value together does not work as expected. Not to mention that this will ignore any time zone issues (since that raw value is actually UTC based).

And that is why I suggest using the Javascript I presented earlier in this thread, which compensates for all that.

Bill Crews

unread,
Dec 25, 2025, 11:03:04 AM12/25/25
to David Gilmore, mementodatabase
Wow! I didn't notice you earlier in the thread, since he's still asking the question. Your method is probably the one to use. 

Can you tell us more about this Memento offset-then-ignore phenomenon? I know about UTC and timezones, but I've never heard of this thing you're talking about that actually affects the millisecond time itself, not just a timezone offset. So, the way to get around the problem is to use Memento functions to do the math? This is upsetting.


David Gilmore

unread,
Dec 25, 2025, 11:18:38 AM12/25/25
to mementodatabase
I discovered this while I was developing my todo-calendar Memento app. I had two date only fields I was trying to compare using the raw values, and they did not compare properly. When I dumped out the time (using Javascript Date routines), I realized why.

Bill Crews

unread,
Dec 25, 2025, 12:06:14 PM12/25/25
to David Gilmore, mementodatabase
It sounds like you discovered the why but not the why of the why, if you know what I mean. I haven't chatted with Vasya in quite a while. I think I'll run it by him. I'll let you know if I learn something. 


Mmm

unread,
Dec 25, 2025, 12:13:59 PM12/25/25
to mementodatabase
В дополнение. В последней версии 5.8... можно задавать поле дата, время, дата и время строкой. Формат строки (дата, время) нужно проверить для своей локали.
Пример скрипта массовых действий:

for (let se of selectedEntries()) {
    if (se.field('date') && se.field('time')) {
        let date_str = moment(se.field('date')).format("DD.MM.YYYY ");//space after year!
        let time_str = moment(se.field('time')).format("HH:mm:ss");
        se.set('date_time', date_str + time_str);
    }
}

Строка "DD.MM.YYYY HH:mm:ss" работает корректно в русской локали.

Шаблон с примером:
четверг, 25 декабря 2025 г. в 20:06:14 UTC+3, bill....@gmail.com:

David Gilmore

unread,
Dec 26, 2025, 10:55:03 AM12/26/25
to mementodatabase
I do not know why Memento does things the way it does, but I can guess. Using the raw time stamp in calculations is discouraged in standard programming practices, unless that time stamp is adjusted first to local time. Standard practices indicate to use one of the many date methods, which will do that Time zone/Summer time compensation for you. I am sure Memento uses those standard methods as well. You can just ignore date or time parts you are not interested in using those methods.

There are two main Date and time methods available. There is the "Moment" library, which Mmm prefers, and demonstrated above. Moment is included in Memento for just this reason. I use Moment for formatting date/time into strings, but I prefer using the standard Javascript Date object methods, as I find those methods more versatile. For newcomers, the Javascript Date object and its methods are well documented on the Internet. I suggest googling "javascript date object" to get started (the w3schools site has excellent tutorials).

And for the newcomers, how do you convert from a Memento Date, Time, or DateTime field into a Javascript Date object?

var dt = new Date(e.field("DateField"));

If I am using a date only field, and I want to do simple compares on it, I will do the compensation from above on the field, usually during a "before save" type trigger. I will set the date to the beginning of my local day (using a Date object method):

dt.setHours(0, 0, 0, 0);

This will zero out the local time offset that the Memento date field might have.

And to set a modified date/time Date object back into the Memento field:

e.set("DateField", dt.getTime());

Bill Crews

unread,
Dec 26, 2025, 6:57:03 PM12/26/25
to David Gilmore, mementodatabase
The main thing I suggest to keep in mind is that things can be confusing when you measure durations, as I think Jorje is doing. When the event covers a reasonably short period of time, like within a day, a simple computation can work fine, but when it might cover a longer period, definitely stick with the Date and Moment methods.

Cricket is an interesting sports event. I understand a match can cover several days. Personally, I've never used an event duration that crossed from one day into another. 


Simon Hall

unread,
Dec 28, 2025, 7:58:50 AM12/28/25
to mementodatabase
Thanks to all of you for the discussion
I have downloaded the template that Mmm suggested but cannot get it to work. I have added a couple of dummy records (without making any alterations to locale) but, when I run the script, I get an error "org.mozilla.javascript.EcmaError: TypeError: Can't set value '26 December 2025 05:37' to field date_time : Unparseable date: "26" (Date + Time.js#8)"

As an aside, I see that the potential date formats in the Russian locale are much more extensive than those in the English locale (eg some include having the Day (eg Sun, ) included). Is this something that Mmm has added (if so, how?) or just that memento is more extensive in Russian!? 

David Gilmore

unread,
Dec 28, 2025, 10:57:46 AM12/28/25
to mementodatabase
I do not know what country you are in, but input date strings need to follow the format for your location. The device settings on your device you are using is where you specify your locale.

If you are in the USA, try "December 26, 2025 05:37" (the US uses MM-DD-YYYY instead of DD-MM-YYYY).

Mmm

unread,
Dec 28, 2025, 12:57:42 PM12/28/25
to mementodatabase
Я не случайно упомянул новую мобильную версию программы.
При ее тестировании заметил, что программа позволяет установить поля даты, время, даты и время с помощью строки. Это не значит, что такой способ работает в настольной версии или других.
Поэтому лучше использовать проверенные способы, о которых упоминал Давид.

Например:

for (let se of selectedEntries()) {
    if (se.field('date') && se.field('time')) {
        let date_str = moment(se.field('date')). format("DD.MM.YYYY ");//space after year!
        let time_str = moment(se.field('time')). format("HH:mm:ss");
        let timestamp = moment(date_str + time_str, "DD.MM.YYYY HH:mm:ss");//Date in the current time zone.
        //let timestamp = moment(date_str + time_str + " +0000", "DD.MM.YYYY HH:mm:ss Z");//Offset from UTC.
        se.set('date_time', new Date(timestamp));
    }
}

Предположу, что в библиотеке Саймона все записи в одном часовом поясе.

воскресенье, 28 декабря 2025 г. в 18:57:46 UTC+3, aa6...@gmail.com:

Simon Hall

unread,
Dec 29, 2025, 1:18:31 AM12/29/25
to mementodatabase
Thanks again for this. I think I'm nearly there with this:

for (let se of selectedEntries()) {

if (se.field('date') && se.field('time')) {

  let date_str = moment(se.field('date')). format("DD/MM/YYYY ");//space after year!


  let time_str = moment(se.field('time')). format("HH:mm:ss");

  se.set('date_time', date_str + time_str);
}
}

This works perfectly, except that the combined field comes out an hour earlier than the source fields, so "26 December 2025" "06:37" produces "26 December 2025 05:37"
Do I need to include an offset in the JS or am I better to spoof the Language/Locale to make out that I'm somewhere I'm not!?

Mmm

unread,
Dec 29, 2025, 6:59:23 AM12/29/25
to mementodatabase
Если не задавать смещение будет часовой пояс устройства. Возможно ещё есть сдвиг сезонного времени.
Это разовая операция, я бы просто подогнал под нужное время и часовой пояс и забыл.
Я не сторонник использования двух отдельных полей даты и времени (либо дата, либо дата и время).

понедельник, 29 декабря 2025 г. в 09:18:31 UTC+3, Simon Hall:
Reply all
Reply to author
Forward
0 new messages