From 024abe6cc7e7eecdfd3307c8481736da2493d2e0 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Fri, 5 Apr 2019 20:46:48 -0700 Subject: [PATCH] LP1816475: Make startOfDay and endOfDay timepickers work Signed-off-by: Jane Sandberg --- .../staff/booking/create-reservation.component.html | 4 ++-- .../app/staff/booking/create-reservation.component.ts | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html index 4cf6b61483..91f0b94865 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html +++ b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html @@ -84,7 +84,7 @@ - +
  • @@ -92,7 +92,7 @@ - +
  • diff --git a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts index a7d2231fbb..6b3882e77a 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts @@ -4,6 +4,7 @@ import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {DateSelectComponent} from '@eg/share/date-select/date-select.component'; import {DateRangeSelectComponent} from '@eg/share/daterange-select/daterange-select.component'; import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; +import {FormatService} from '@eg/core/format.service'; import {GridComponent} from '@eg/share/grid/grid.component'; import {GridDataSource, GridRowFlairEntry} from '@eg/share/grid/grid'; import {IdlObject} from '@eg/core/idl.service'; @@ -26,6 +27,8 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { isBooked: (col: any, row: any) => string; resourceAvailabilityIcon: (row: any) => GridRowFlairEntry; + startOfDay: NgbTimeStruct = {hour: 9, minute: 0, second: 0}; + endOfDay: NgbTimeStruct = {hour: 17, minute: 0, second: 0}; startTime: Moment; endTime: Moment; granularity: 15 | 30 | 60 | 1440 = 30; // 1440 minutes = 24 hours @@ -46,6 +49,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { @ViewChild('newDialog') newDialog: FmRecordEditorComponent; constructor( + private format: FormatService, private pcrud: PcrudService, private store: ServerStoreService, private toast: ToastService, @@ -151,7 +155,8 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { order_by: 'barcode ASC', flesh: 2, flesh_fields: {'brsrc': ['curr_rsrcs'], 'bresv': ['usr']}, - select: {'curr_rsrcs': {'end_time': {'>' : Moment([], 'Asia/Tokyo').startOf('day').toISOString()}, 'start_time': {'<': Moment([], 'Asia/Tokyo').add(1,'days').endOf('day').toISOString()}}} + select: {'curr_rsrcs': {'end_time': {'>' : Moment([], this.format.wsOrgTimezone).startOf('day').toISOString()}, + 'start_time': {'<': Moment([], this.format.wsOrgTimezone).add(1,'days').endOf('day').toISOString()}}} }).subscribe( r => { this.resources.push(r); @@ -160,13 +165,17 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { this.startTime = Moment.tz([ dl.current.year, dl.current.month - 1, - dl.current.day, 9], - 'Asia/Tokyo'); + dl.current.day, + this.startOfDay.hour, + this.startOfDay.minute], + this.format.wsOrgTimezone); this.endTime = Moment.tz([ dl.current.year, dl.current.month - 1, - dl.current.day, 17], - 'Asia/Tokyo'); + dl.current.day, + this.endOfDay.hour, + this.endOfDay.minute], + this.format.wsOrgTimezone); }); let currentTime = this.startTime; while (currentTime < this.endTime) { -- 2.11.0