After our upgrade to 10.1.5 I have noticed a change.
Before, in version 9.2, whenever I pulled in the LastVisitedDate from a user profile, if the user has never visited after their account creation (null value in SQL), then it also returned null.
Now running the same scripts, then it returns 1/1/0001 12:00:00 AM.
Is this by design, or is it a bug?
Really you should avoid pulling stuff directly from the database as the schema changes between even minor versions. If the information is not available in the standard API the better approach is to hook the presence or logon events in a plugin and store the extra data either in extended attributes or a custom table. We have samples in our common code on how to do this.
Not pulling anything directly from the database. Using the API: $core_v2_user
ah apologies I miss understood, sounds like something changed in the code.
$user.LastVisitedDate > '0001-1-1 00:00:00.000' won't work as you are doing a less than comparison on a string. Have you tried
$user.LastVisitedDate != '0001-1-1 00:00:00.000'
$user.LastVisitedDate > $core_v2_utility.ParseDate("1", "1","1")
I recommend Robert Nash's second work-around. I've also logged this as a bug: