diff --git a/package.json b/package.json index 9f98f1cd3..1791b6aeb 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dragula": "3.7.2", "intl": "1.2.5", "microedge-rxstate": "2.0.0", - "moment": "2.18.1", + "moment": "2.21.0", "ng2-dragula": "1.5.0", "ng2-toastr": "4.1.2", "web-animations-js": "2.3.1" diff --git a/src/modules/datepicker/date-formatter.ts b/src/modules/datepicker/date-formatter.ts index 85587fc63..de5f70909 100644 --- a/src/modules/datepicker/date-formatter.ts +++ b/src/modules/datepicker/date-formatter.ts @@ -1,4 +1,4 @@ -let moment = require('moment'); +const moment = require('moment'); export class SkyDateFormatter { public format(date: Date, format: string): string { diff --git a/src/modules/datepicker/datepicker-calendar.component.spec.ts b/src/modules/datepicker/datepicker-calendar.component.spec.ts index f5a3f4928..014003365 100644 --- a/src/modules/datepicker/datepicker-calendar.component.spec.ts +++ b/src/modules/datepicker/datepicker-calendar.component.spec.ts @@ -17,7 +17,7 @@ import { import { By } from '@angular/platform-browser'; -let moment = require('moment'); +const moment = require('moment'); describe('datepicker calendar', () => { diff --git a/src/modules/datepicker/datepicker-config.service.ts b/src/modules/datepicker/datepicker-config.service.ts index 88cec72d0..8ea1f02ad 100644 --- a/src/modules/datepicker/datepicker-config.service.ts +++ b/src/modules/datepicker/datepicker-config.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { SkyWindowRefService } from '../window'; -let moment = require('moment'); +const moment = require('moment'); import 'moment/min/locales.min'; @Injectable() diff --git a/src/modules/datepicker/datepicker.component.spec.ts b/src/modules/datepicker/datepicker.component.spec.ts index 51fca4c78..16e89d071 100644 --- a/src/modules/datepicker/datepicker.component.spec.ts +++ b/src/modules/datepicker/datepicker.component.spec.ts @@ -42,7 +42,7 @@ import {By} from '@angular/platform-browser'; import { SkyWindowRefService } from '../window'; -let moment = require('moment'); +const moment = require('moment'); describe('datepicker', () => { diff --git a/src/modules/link-records/state/fields/fields.orchestrator.ts b/src/modules/link-records/state/fields/fields.orchestrator.ts index f8d06c025..1485ecda9 100644 --- a/src/modules/link-records/state/fields/fields.orchestrator.ts +++ b/src/modules/link-records/state/fields/fields.orchestrator.ts @@ -1,6 +1,6 @@ import { SkyLinkRecordsStateOrchestrator } from '../link-records-state.rxstate'; import { AsyncItem } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); import { SkyLinkRecordsFieldModel } from './field.model'; import { diff --git a/src/modules/link-records/state/matches/matches.orchestrator.ts b/src/modules/link-records/state/matches/matches.orchestrator.ts index 2ccd54854..9ea9b8dfa 100644 --- a/src/modules/link-records/state/matches/matches.orchestrator.ts +++ b/src/modules/link-records/state/matches/matches.orchestrator.ts @@ -1,6 +1,6 @@ import { SkyLinkRecordsStateOrchestrator } from '../link-records-state.rxstate'; import { AsyncList } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); import { SKY_LINK_RECORDS_STATUSES } from '../../link-records-statuses'; import { SkyLinkRecordsMatchModel } from './match.model'; diff --git a/src/modules/link-records/state/results/results.orchestrator.ts b/src/modules/link-records/state/results/results.orchestrator.ts index 912fc7d1f..fbd863088 100644 --- a/src/modules/link-records/state/results/results.orchestrator.ts +++ b/src/modules/link-records/state/results/results.orchestrator.ts @@ -1,6 +1,6 @@ import { SkyLinkRecordsStateOrchestrator } from '../link-records-state.rxstate'; import { AsyncList } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); import { SkyLinkRecordsResultModel } from './result.model'; import { SkyLinkRecordsResultsLoadAction } from './actions'; diff --git a/src/modules/link-records/state/selected/selected.orchestrator.ts b/src/modules/link-records/state/selected/selected.orchestrator.ts index 00fb68a24..62b838732 100644 --- a/src/modules/link-records/state/selected/selected.orchestrator.ts +++ b/src/modules/link-records/state/selected/selected.orchestrator.ts @@ -1,6 +1,6 @@ import { SkyLinkRecordsStateOrchestrator } from '../link-records-state.rxstate'; import { AsyncItem } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); import { SkyLinkRecordsSelectedSetSelectedAction, diff --git a/src/modules/list-data-provider-in-memory/list-data-in-memory.provider.ts b/src/modules/list-data-provider-in-memory/list-data-in-memory.provider.ts index d9c2aa90d..287ee9011 100644 --- a/src/modules/list-data-provider-in-memory/list-data-in-memory.provider.ts +++ b/src/modules/list-data-provider-in-memory/list-data-in-memory.provider.ts @@ -13,7 +13,7 @@ import { getData } from '../list/helpers'; -let moment = require('moment'); +const moment = require('moment'); export class SkyListInMemoryDataProvider extends ListDataProvider { public items: BehaviorSubject> = diff --git a/src/modules/list-paging/list-paging.component.spec.ts b/src/modules/list-paging/list-paging.component.spec.ts index 964ab69de..371f3df8e 100644 --- a/src/modules/list-paging/list-paging.component.spec.ts +++ b/src/modules/list-paging/list-paging.component.spec.ts @@ -24,14 +24,12 @@ import { ListItemModel } from '../list/state/items/item.model'; import { AsyncList } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); describe('List Paging Component', () => { let state: ListState, dispatcher: ListStateDispatcher, - component: ListPagingTestComponent, fixture: any, - nativeElement: HTMLElement, element: DebugElement; beforeEach(async(() => { @@ -52,9 +50,7 @@ describe('List Paging Component', () => { }); fixture = TestBed.createComponent(ListPagingTestComponent); - nativeElement = fixture.nativeElement as HTMLElement; element = fixture.debugElement as DebugElement; - component = fixture.componentInstance; fixture.detectChanges(); // always skip the first update to ListState, when state is ready diff --git a/src/modules/list-toolbar/list-toolbar-item.component.ts b/src/modules/list-toolbar/list-toolbar-item.component.ts index 4887f00a0..ef84c19a2 100644 --- a/src/modules/list-toolbar/list-toolbar-item.component.ts +++ b/src/modules/list-toolbar/list-toolbar-item.component.ts @@ -1,5 +1,5 @@ import { Component, Input, ContentChildren, TemplateRef, QueryList } from '@angular/core'; -let moment = require('moment'); +const moment = require('moment'); @Component({ selector: 'sky-list-toolbar-item', diff --git a/src/modules/list-view-checklist/list-view-checklist.component.spec.ts b/src/modules/list-view-checklist/list-view-checklist.component.spec.ts index 3f8c6a152..15236c9c0 100644 --- a/src/modules/list-view-checklist/list-view-checklist.component.spec.ts +++ b/src/modules/list-view-checklist/list-view-checklist.component.spec.ts @@ -11,7 +11,7 @@ import { ListState, ListStateDispatcher } from '../list/state'; -let moment = require('moment'); +const moment = require('moment'); import { ListViewsLoadAction } from '../list/state/views/actions'; import { ListViewModel } from '../list/state/views/view.model'; import { ListItemModel } from '../list/state/items/item.model'; diff --git a/src/modules/list-view-checklist/state/items/items.orchestrator.ts b/src/modules/list-view-checklist/state/items/items.orchestrator.ts index 0ee18142d..ff71fa273 100644 --- a/src/modules/list-view-checklist/state/items/items.orchestrator.ts +++ b/src/modules/list-view-checklist/state/items/items.orchestrator.ts @@ -14,7 +14,7 @@ import { ListViewChecklistItemsLoadAction } from './actions'; -let moment = require('moment'); +const moment = require('moment'); export class ListViewChecklistItemsOrchestrator extends ChecklistStateOrchestrator> { diff --git a/src/modules/list-view-grid/list-view-grid.component.spec.ts b/src/modules/list-view-grid/list-view-grid.component.spec.ts index 6e8eb637b..27d8e5042 100644 --- a/src/modules/list-view-grid/list-view-grid.component.spec.ts +++ b/src/modules/list-view-grid/list-view-grid.component.spec.ts @@ -11,7 +11,8 @@ import { ListState, ListStateDispatcher } from '../list/state'; -let moment = require('moment'); + +const moment = require('moment'); import { ListViewsLoadAction diff --git a/src/modules/list-view-grid/state/columns/columns.orchestrator.ts b/src/modules/list-view-grid/state/columns/columns.orchestrator.ts index 4f0fd32bc..4c1dfb69f 100644 --- a/src/modules/list-view-grid/state/columns/columns.orchestrator.ts +++ b/src/modules/list-view-grid/state/columns/columns.orchestrator.ts @@ -4,7 +4,7 @@ import { AsyncList } from 'microedge-rxstate/dist'; import { SkyGridColumnModel } from '../../../grid'; import { ListViewGridColumnsLoadAction } from './actions'; -let moment = require('moment'); +const moment = require('moment'); export class ListViewGridColumnsOrchestrator extends GridStateOrchestrator> { diff --git a/src/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.ts b/src/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.ts index dbc03b970..5fef3ed91 100644 --- a/src/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.ts +++ b/src/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.ts @@ -4,7 +4,7 @@ import { AsyncList } from 'microedge-rxstate/dist'; import { SkyGridColumnModel } from '../../../grid'; import { ListViewDisplayedGridColumnsLoadAction } from './actions'; -let moment = require('moment'); +const moment = require('moment'); export class ListViewDisplayedGridColumnsOrchestrator extends GridStateOrchestrator> { diff --git a/src/modules/list/list.component.spec.ts b/src/modules/list/list.component.spec.ts index 5610415a6..f78472911 100644 --- a/src/modules/list/list.component.spec.ts +++ b/src/modules/list/list.component.spec.ts @@ -12,7 +12,7 @@ import { ListState, ListStateDispatcher } from '../list/state'; -let moment = require('moment'); +const moment = require('moment'); import { Observable } from 'rxjs/Observable'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; diff --git a/src/modules/list/list.component.ts b/src/modules/list/list.component.ts index 3c0bc56c1..cdef58ecf 100644 --- a/src/modules/list/list.component.ts +++ b/src/modules/list/list.component.ts @@ -77,7 +77,8 @@ import { ListItemModel } from './state/items/item.model'; import { isObservable } from './helpers'; -let moment = require('moment'); + +const moment = require('moment'); @Component({ selector: 'sky-list', diff --git a/src/modules/list/state/items/items.orchestrator.ts b/src/modules/list/state/items/items.orchestrator.ts index 0fa6a234f..6e6948c31 100644 --- a/src/modules/list/state/items/items.orchestrator.ts +++ b/src/modules/list/state/items/items.orchestrator.ts @@ -1,7 +1,7 @@ import { ListStateOrchestrator } from '../list-state.rxstate'; import { AsyncList } from 'microedge-rxstate/dist'; -let moment = require('moment'); +const moment = require('moment'); import { ListItemModel } from './item.model'; import { diff --git a/src/modules/list/state/selected/selected.orchestrator.ts b/src/modules/list/state/selected/selected.orchestrator.ts index 243bb8de3..21076c43b 100644 --- a/src/modules/list/state/selected/selected.orchestrator.ts +++ b/src/modules/list/state/selected/selected.orchestrator.ts @@ -9,7 +9,7 @@ import { ListSelectedSetItemsSelectedAction } from './actions'; -let moment = require('moment'); +const moment = require('moment'); export class ListSelectedOrchestrator extends ListStateOrchestrator> { /* istanbul ignore next */ diff --git a/src/modules/timepicker/timepicker-component.spec.ts b/src/modules/timepicker/timepicker-component.spec.ts index a33023d0e..f56459ea6 100644 --- a/src/modules/timepicker/timepicker-component.spec.ts +++ b/src/modules/timepicker/timepicker-component.spec.ts @@ -17,7 +17,7 @@ import { TimepickerTestComponent } from './fixtures/timepicker-component.fixture import { expect } from '../testing'; -let moment = require('moment'); +const moment = require('moment'); describe('Timepicker', () => { function openTimepicker(element: HTMLElement, compFixture: ComponentFixture) { diff --git a/src/modules/timepicker/timepicker.component.ts b/src/modules/timepicker/timepicker.component.ts index d6890a2d5..4cda6b090 100644 --- a/src/modules/timepicker/timepicker.component.ts +++ b/src/modules/timepicker/timepicker.component.ts @@ -15,7 +15,7 @@ import { import { SkyTimepickerTimeOutput } from './timepicker.interface'; -let moment = require('moment'); +const moment = require('moment'); @Component({ selector: 'sky-timepicker', @@ -101,7 +101,7 @@ export class SkyTimepickerComponent implements OnInit { hour: moment(this.activeTime).hour(), minute: moment(this.activeTime).minute(), meridie: moment(this.activeTime).format('A'), - timezone: moment(this.activeTime).format('Z'), + timezone: parseInt(moment(this.activeTime).format('Z'), 10), iso8601: this.activeTime, local: moment(this.activeTime).format(this.localeFormat), customFormat: (typeof this.returnFormat !== 'undefined') @@ -136,7 +136,7 @@ export class SkyTimepickerComponent implements OnInit { }); } - private set selectedHour(setHour: number) { + public set selectedHour(setHour: number) { let hour: number; let hourOffset: number = 0; if (this.selectedMeridies === 'AM' && setHour === 12) { hourOffset = -12; } @@ -147,29 +147,29 @@ export class SkyTimepickerComponent implements OnInit { this.activeTime = moment({ 'hour': hour, 'minute': moment(this.activeTime).get('minute') + 0 - }).format(); + }).toDate(); this.selectedTimeChanged.emit(this.selectedTime); } - private set selectedMinute(minute: number) { + public set selectedMinute(minute: number) { this.activeTime = moment({ 'hour': moment(this.activeTime).get('hour') + 0, 'minute': minute - }).format(); + }).toDate(); this.selectedTimeChanged.emit(this.selectedTime); } - private set selectedMeridies(meridies: string) { + public set selectedMeridies(meridies: string) { /* istanbul ignore else */ if (!this.is8601) { if (meridies !== this.selectedMeridies) { - this.activeTime = moment(this.activeTime).add(12, 'hours').format(); + this.activeTime = moment(this.activeTime).add(12, 'hours').toDate(); this.selectedTimeChanged.emit(this.selectedTime); } } } - private get selectedHour() { + public get selectedHour() { if (!this.is8601) { /* istanbul ignore next */ return parseInt(moment(this.activeTime).format('h'), 0) || 1; @@ -178,13 +178,13 @@ export class SkyTimepickerComponent implements OnInit { if (this.is8601) { return moment(this.activeTime).hour() + 0; } - } - private get selectedMinute() { + + public get selectedMinute() { return moment(this.activeTime).minute() + 0; } - private get selectedMeridies() { + public get selectedMeridies() { if (this.activeTime) { return moment(this.activeTime).format('A'); } diff --git a/src/modules/timepicker/timepicker.directive.ts b/src/modules/timepicker/timepicker.directive.ts index ef2dbf04a..57097d7d8 100644 --- a/src/modules/timepicker/timepicker.directive.ts +++ b/src/modules/timepicker/timepicker.directive.ts @@ -10,7 +10,7 @@ import { OnChanges, SimpleChanges } from '@angular/core'; -let moment = require('moment'); +const moment = require('moment'); import { SkyTimepickerComponent } from './timepicker.component'; @@ -152,8 +152,8 @@ export class SkyTimepickerInputDirective implements 'hour': moment(time, currentFormat).hour(), 'minute': moment(time, currentFormat).minute(), 'meridie': moment(time, currentFormat).format('A'), - 'timezone': moment(time, currentFormat).format('Z'), - 'iso8601': moment(time, currentFormat).format(), + 'timezone': parseInt(moment(time, currentFormat).format('Z'), 10), + 'iso8601': moment(time, currentFormat).toDate(), 'local': moment(time, currentFormat).format(currentFormat), 'customFormat': this.returnFormat };