hi <@U01NZ4D0LDD>, are you planning to implement t...
# community-help
l
hi @Jason Bosco, are you planning to implement the timestamp like firebase in the field types?
j
@Loïc A contributor recently added support for this, along with nested fields in the extension
So the Firebase extension will automatically convert Firebase data types to Typesense data types
in this case, dates will be converted to unix timestamps automatically
l
Is it live already on the current Firebase extension and schema v0.22.2?
j
Yup, you want to use v0.3.0 of the extension
l
So in the schema you put int64 as field type to receive the timestamp data?
j
Correct
l
Perfect thank you. Do you know if it converts the timestamp in
DateTime.now().millisecondsSinceEpoch
?
l
Yes,
Math.floor(value.toDate().getTime() / 1000);
I don’t know if it
millisecondsSinceEpoch
or
millisecond
I will try it out
Thank you Jason
j
👍
l
congrats on the Google IO featured 🔥
j
Thank you! 😄
l
Hi @Jason Bosco , I was able to send
Timestamp
from Firebase -> to Typesense
int64
When I do the other way, I search and receive the
int64
in my app and it is the same value as in Typesense ✔️ However, this Timestamp (for example: 1652386231) is supposed to be in
millisecondsSinceEpoch
but for some reason if I want to compare a date I have to use the received Timestamp as
millisecondsSinceEpoch
but the other date as
seconds
For example if I get the
lastConnection
from a Typesense search and I then want to compare I have to do:
lastConnection.millisecondsSinceEpoch > Timestamp.fromDate(DateTime.now().subtract(const Duration(seconds: 70))).seconds
It seems to me that the Timestamp conversation is not going well in the process
j
Notice the
/ 1000
part
l
Yes but in reality it is not was it does. The Timestamp in Firebase is in nanoseconds. Example of timestamp in second: 1652386236 Example of timestamp in millisecond: 1652386236975 Example of timestamp stored in typesense: 1652386231
j
Hm are you sure? Current epoch time is `1652386958`: https://www.epochconverter.com/
Just saw your edit
👍 1
You should see timestamps stored in seconds in Typesense
l
Ok, I will edit everything for seconds then. Thank you @Jason Bosco
👍 1