#366 Feature: Time Interval Buttons (on Shifts page): Formatting mimimi

This commit is contained in:
Igor Scheller 2017-11-29 13:49:21 +01:00
parent 0b45d2a88f
commit b29e23f086
1 changed files with 10 additions and 10 deletions

View File

@ -21,14 +21,14 @@ function checkAll(id, checked) {
* @param {moment} date * @param {moment} date
*/ */
function formatDay(date) { function formatDay(date) {
return date.format('YYYY-MM-DD') return date.format("YYYY-MM-DD");
} }
/** /**
* @param {moment} date * @param {moment} date
*/ */
function formatTime(date) { function formatTime(date) {
return date.format('HH:mm') return date.format("HH:mm");
} }
/** /**
@ -36,13 +36,13 @@ function formatTime(date) {
* @param {moment} to * @param {moment} to
*/ */
function setInput(from, to) { function setInput(from, to) {
var from_day = $('#start_day'), from_time = $('#start_time'), to_day = $('#end_day'), to_time = $('#end_time'); var fromDay = $("#start_day"), fromTime = $("#start_time"), toDay = $("#end_day"), toTime = $("#end_time");
from_day.val(formatDay(from)); fromDay.val(formatDay(from));
from_time.val(formatTime(from)); fromTime.val(formatTime(from));
to_day.val(formatDay(to)); toDay.val(formatDay(to));
to_time.val(formatTime(to)); toTime.val(formatTime(to));
} }
function setDay(days) { function setDay(days) {
@ -51,12 +51,12 @@ function setDay(days) {
var from = moment(); var from = moment();
from.hours(0).minutes(0).seconds(0); from.hours(0).minutes(0).seconds(0);
from.add(days, 'd'); from.add(days, "d");
var to = from.clone(); var to = from.clone();
to.hours(23).minutes(59); to.hours(23).minutes(59);
setInput(from, to) setInput(from, to);
} }
function setHours(hours) { function setHours(hours) {
@ -65,7 +65,7 @@ function setHours(hours) {
var from = moment(); var from = moment();
var to = from.clone(); var to = from.clone();
to.add(hours, 'h'); to.add(hours, "h");
if (to < from) { if (to < from) {
setInput(to, from); setInput(to, from);
return; return;