44use OCP \AppFramework \Http \TemplateResponse ;
55use OCP \AppFramework \Http \DataResponse ;
66use OCP \AppFramework \Controller ;
7+ use OCP \IL10N ;
78use OCP \IUserSession ;
89use OCA \TimeTracker \Db \WorkIntervalMapper ;
910use OCA \TimeTracker \Db \WorkInterval ;
@@ -46,8 +47,9 @@ class AjaxController extends Controller {
4647 protected $ reportItemMapper ;
4748 protected $ timelineMapper ;
4849 protected $ timelineEntryMapper ;
50+ protected $ l10n ;
4951
50- public function __construct ($ AppName , IRequest $ request , IUserSession $ userSession ,
52+ public function __construct ($ AppName , IRequest $ request , IUserSession $ userSession , IL10N $ l10n ,
5153 WorkIntervalMapper $ workIntervalMapper , ClientMapper $ clientMapper , UserToClientMapper $ userToClientMapper ,
5254 ProjectMapper $ projectMapper , UserToProjectMapper $ userToProjectMapper , TagMapper $ tagMapper , WorkIntervalToTagMapper $ workIntervalToTagMapper , ReportItemMapper $ reportItemMapper ,
5355 TimelineMapper $ timelineMapper , TimelineEntryMapper $ timelineEntryMapper , GoalMapper $ goalMapper , $ UserId ){
@@ -71,6 +73,7 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi
7173 $ this ->timelineEntryMapper = $ timelineEntryMapper ;
7274
7375 $ this ->request = $ request ;
76+ $ this ->l10n = $ l10n ;
7477 }
7578
7679 /**
@@ -82,9 +85,13 @@ public function workIntervals() {
8285 $ to = $ this ->request ->to ;
8386 $ l = $ this ->workIntervalMapper ->findLatestInterval ($ this ->userId , $ from , $ to );
8487 $ days = [];
88+ $ tzoffset = 0 ;
89+ if (isset ($ this ->request ->tzoffset )) {
90+ $ tzoffset = -($ this ->request ->tzoffset * 60 );
91+ }
92+ date_default_timezone_set ('UTC ' );
8593 foreach ($ l as $ wi ){
86- //$dt = date("d/m/Y", $wi->start);
87- $ dt = date ("D, j M " , $ wi ->start );
94+ $ dt = $ this ->l10n ->l ('date ' , $ wi ->start +$ tzoffset , ['width ' => 'medium ' ]);
8895 if (!isset ($ days [$ dt ])){
8996 $ days [$ dt ] = [];
9097 }
0 commit comments