Use an IContextSource instead of globals in addDate method

added $context as a parameter to the method and replaced
the global variables with $lang and $user that get the same
data using $context.

bug: 52347
Change-Id: Idccabbf555a1f95cd4b0ac6695ffb61843876838
Merge "Use an IContextSource instead of globals in addDate method"