MDL-66804 user: consistent user access times in privacy export.
[moodle.git] / user / classes / privacy / provider.php
index b31b2e6..839026e 100644 (file)
@@ -385,10 +385,10 @@ class provider implements
             'calendartype' => $user->calendartype,
             'theme' => $user->theme,
             'timezone' => $user->timezone,
-            'firstaccess' => transform::datetime($user->firstaccess),
-            'lastaccess' => transform::datetime($user->lastaccess),
-            'lastlogin' => transform::datetime($user->lastlogin),
-            'currentlogin' => $user->currentlogin,
+            'firstaccess' => $user->firstaccess ? transform::datetime($user->firstaccess) : null,
+            'lastaccess' => $user->lastaccess ? transform::datetime($user->lastaccess) : null,
+            'lastlogin' => $user->lastlogin ? transform::datetime($user->lastlogin) : null,
+            'currentlogin' => $user->currentlogin ? transform::datetime($user->currentlogin) : null,
             'lastip' => $user->lastip,
             'secret' => $user->secret,
             'picture' => $user->picture,