From 4cab3932fa23dd14b375945a972cf4d01f6b53a8 Mon Sep 17 00:00:00 2001 From: "chris.watts90@outlook.com" Date: Fri, 21 Apr 2017 09:19:26 +0100 Subject: [PATCH] added goToToday click handler for viewModel. this is to change the date on the picker control to todays date as the bootstrap datepicker control today button doesnt appear to be working. #83 --- .../WindowsDataCenter/www/spa.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js index b7629a1..ebdfd1a 100644 --- a/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js +++ b/DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/spa.js @@ -52,6 +52,11 @@ } location.hash = url; }; + self.goToToday = function(a, b, c) { + self.goToTimeLogs(self.chosenTimeLogUserId, + null, + [{ key: "selectedDate", value: moment(new Date()).format("MM-DD-YYYY") }]); + }; self.assignErrorObject = function(errCode, errMessage, errorSource) { var errDat = { errorCode: errCode, @@ -176,9 +181,9 @@ } moment.locale("en", { week: { dow: 1 } }); $("#weeklyDatePicker").datetimepicker({ + //showTodayButton: true, format: "DD/MM/YYYY", inline: true, - showTodayButton: true, calendarWeeks: true, maxDate: "now", date: selectedDate @@ -369,12 +374,13 @@ ]); function editlog (data) { self.manualLog(data); - $('#manualLogDialog').modal("show"); - $('#datetimepicker1').datetimepicker({ + $("#manualLogDialog").modal("show"); + $("#datetimepicker1").datetimepicker({ format: "YYYY-DD-MM HH:mm:ss", date: new Date(data.EventTime), - minDate: moment(new Date(data.EventTime)).startOf('week'), - maxDate: moment(new Date(data.EventTime)).endOf('week') + sideBySide: true, + minDate: moment(new Date(data.EventTime)).startOf("week"), + maxDate: moment(new Date(data.EventTime)).endOf("week") }); self.assignUpdateHandler(); };