If user passed a date object to fetch message api, use beforeTime. If user pass string to the api, fetch messages by before message id.