How can this be...

I am trying to sort a number of Messages’ chats by time but was getting very strange results. I decided to write a small script to test whether the Message’s chat’s update property was working properly:

The script is:

 
tell application "Messages"
	
	set myChats to chats
	
	repeat with aChat in myChats
		set aChatTimeStarted to started of aChat
		set aChatTimeUpdated to updated of aChat
		log aChatTimeStarted
		log aChatTimeUpdated
		if (aChatTimeStarted = aChatTimeUpdated) then
			set aChatTimeWorking to "False"
		else
			set aChatTimeWorking to "True"
		end if
		log aChatTimeWorking
	end repeat
	
end tell

The output / results from running the script on 3 chats is (with the phone numbers being overwritten):
tell application “Messages”
get every chat
get started of text chat id “iMessage;-;+1aaabbbcccc”
get updated of text chat id “iMessage;-;+1aaabbbccc”
(date Monday, December 1 , 2014 at 2:12:00 PM)
(date Monday, December 1 , 2014 at 2:12:00 PM)
(False)
get started of text chat id “iMessage;-;+1dddeeeffff”
get updated of text chat id “iMessage;-;+1dddeeeffff”
(date Tuesday, December 2 , 2014 at 7:00:38 AM)
(date Tuesday, December 2 , 2014 at 7:00:38 AM)
(False)
get started of text chat id “iMessage;-;+1ggghhhiiii”
get updated of text chat id “iMessage;-;+1ggghhhiii”
(date Tuesday, December 2 , 2014 at 7:51:26 AM)
(date Tuesday, December 2 , 2014 at 7:51:26 AM)
(False)
end tell

Note that the start time and the update time are both the same [and, for what it is worth, are reporting the updated time…how can this be…is it my code, is there a bug in Messages, etc?

Thanks…

Hi JoelC.

I don’t know what you’re expecting, but the ‘log’ results exactly match what’s written in the script “ ie. “False” when the two dates are the same. Are you expecting the dates to be different?

Apologies, I should have been clearer.

As each chat has a number of exchanges I would expect the “start date” and the “updated date” to be diffierent…is this incorrect?