Dashboards: Conserve timestamp on time range copy-paste across timezones (#109769)
* fix(timepicker): preserve UTC timestamp on copy-paste across timezones * test: add UTC copy/paste timezone conversion test * Update packages/grafana-ui/src/components/DateTimePickers/TimeRangePicker/TimeRangeContent.test.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove duplicate mockClipboard clear * Extract utility functions for formatting and converting time ranges --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
a746f6e121
commit
be3fa041a5
@@ -505,3 +505,14 @@ export function relativeToTimeRange(relativeTimeRange: RelativeTimeRange, now: D
|
||||
raw: { from, to },
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Returns a RawTimeRange that has been converted so that from and to are strings
|
||||
*/
|
||||
export function formatRawTimeRange(range: RawTimeRange): RawTimeRange {
|
||||
return {
|
||||
from: isDateTime(range.from) ? range.from.toISOString() : range.from,
|
||||
to: isDateTime(range.to) ? range.to.toISOString() : range.to,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user