Skip to content

Commit 147f408

Browse files
the bb documentation says date filters are in seconds, but are actually milliseconds
1 parent dc20080 commit 147f408

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

imessage/bluebubbles/api.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ func (bb *blueBubbles) queryChatMessages(query MessageQueryRequest, allResults [
436436
func (bb *blueBubbles) GetMessagesSinceDate(chatID string, minDate time.Time, backfillID string) (resp []*imessage.Message, err error) {
437437
bb.log.Trace().Str("chatID", chatID).Time("minDate", minDate).Str("backfillID", backfillID).Msg("GetMessagesSinceDate")
438438

439-
after := minDate.Unix()
439+
after := minDate.UnixNano() / int64(time.Millisecond)
440440
request := MessageQueryRequest{
441441
ChatGUID: chatID,
442442
Limit: 100,
@@ -475,8 +475,8 @@ func (bb *blueBubbles) GetMessagesSinceDate(chatID string, minDate time.Time, ba
475475
func (bb *blueBubbles) GetMessagesBetween(chatID string, minDate, maxDate time.Time) (resp []*imessage.Message, err error) {
476476
bb.log.Trace().Str("chatID", chatID).Time("minDate", minDate).Time("maxDate", maxDate).Msg("GetMessagesBetween")
477477

478-
after := minDate.Unix()
479-
before := maxDate.Unix()
478+
after := minDate.UnixNano() / int64(time.Millisecond)
479+
before := maxDate.UnixNano() / int64(time.Millisecond)
480480
request := MessageQueryRequest{
481481
ChatGUID: chatID,
482482
Limit: 100,
@@ -516,7 +516,7 @@ func (bb *blueBubbles) GetMessagesBetween(chatID string, minDate, maxDate time.T
516516
func (bb *blueBubbles) GetMessagesBeforeWithLimit(chatID string, before time.Time, limit int) (resp []*imessage.Message, err error) {
517517
bb.log.Trace().Str("chatID", chatID).Time("before", before).Int("limit", limit).Msg("GetMessagesBeforeWithLimit")
518518

519-
_before := before.Unix()
519+
_before := before.UnixNano() / int64(time.Millisecond)
520520
request := MessageQueryRequest{
521521
ChatGUID: chatID,
522522
Limit: int64(limit),

0 commit comments

Comments
 (0)