grafana/ui: Add Time of day picker (#18894)

* Adding DashboardPicker component

* fix prop names

* fix prop names pt2

* add component and modify utils

* add showHour prop

* add minuteStep to TimeOfDayPicker, add value to DashboardPicker

* fix for dashboard picker, missed adding file

* Adding story

* add another story for hiding hour and style fixes

* fix these generated files

* fixes after review

* rename current value

* fix type issue on onChange

* fix story
This commit is contained in:
Peter Holmberg
2019-09-11 09:00:14 +02:00
committed by GitHub
parent 7b856ae040
commit 196f8503a8
13 changed files with 161 additions and 9 deletions

View File

@@ -1,7 +1,6 @@
import { TimeZone } from '../types/time';
/* tslint:disable:import-blacklist ban ban-types */
import moment, { MomentInput, DurationInputArg1 } from 'moment';
import moment, { Moment, MomentInput, DurationInputArg1 } from 'moment';
export interface DateTimeBuiltinFormat {
__momentBuiltinFormatBrand: any;
}
@@ -72,6 +71,7 @@ export interface DateTime extends Object {
utc: () => DateTime;
utcOffset: () => number;
hour?: () => number;
minute?: () => number;
}
export const setLocale = (language: string) => {
@@ -98,6 +98,10 @@ export const dateTime = (input?: DateTimeInput, formatInput?: FormatInput): Date
return moment(input as MomentInput, formatInput) as DateTime;
};
export const dateTimeAsMoment = (input?: DateTimeInput) => {
return dateTime(input) as Moment;
};
export const dateTimeForTimeZone = (
timezone?: TimeZone,
input?: DateTimeInput,