mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.16`: - [Fix wrong date on a header of a report when generated from relative date (#197027)](https://github.com/elastic/kibana/pull/197027) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2024-10-22T10:23:37Z","message":"Fix wrong date on a header of a report when generated from relative date (#197027)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/148224\r\n\r\nThere was an issue when generating a PDF report from a dashboard with\r\nrelative date with time range display in the header of the report. Note:\r\nthere data was displayed correctly, the issue was only with the date in\r\nthe header:\r\n\r\nDashboard: \r\n\r\n\r\n\r\n\r\nReport before the fix 👎 \r\n\r\n\r\n\r\nReport after the fix 👍 \r\n\r\n\r\n","sha":"0ce828c470c43434343101ed22b45863d3ed68e9","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","SharedUX/fix-it-week","Team:SharedUX","backport:prev-major","Feature:Reporting:Screenshot"],"title":"Fix wrong date on a header of a report when generated from relative date","number":197027,"url":"https://github.com/elastic/kibana/pull/197027","mergeCommit":{"message":"Fix wrong date on a header of a report when generated from relative date (#197027)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/148224\r\n\r\nThere was an issue when generating a PDF report from a dashboard with\r\nrelative date with time range display in the header of the report. Note:\r\nthere data was displayed correctly, the issue was only with the date in\r\nthe header:\r\n\r\nDashboard: \r\n\r\n\r\n\r\n\r\nReport before the fix 👎 \r\n\r\n\r\n\r\nReport after the fix 👍 \r\n\r\n\r\n","sha":"0ce828c470c43434343101ed22b45863d3ed68e9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197027","number":197027,"mergeCommit":{"message":"Fix wrong date on a header of a report when generated from relative date (#197027)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/148224\r\n\r\nThere was an issue when generating a PDF report from a dashboard with\r\nrelative date with time range display in the header of the report. Note:\r\nthere data was displayed correctly, the issue was only with the date in\r\nthe header:\r\n\r\nDashboard: \r\n\r\n\r\n\r\n\r\nReport before the fix 👎 \r\n\r\n\r\n\r\nReport after the fix 👍 \r\n\r\n\r\n","sha":"0ce828c470c43434343101ed22b45863d3ed68e9"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
This commit is contained in:
parent
27e881576e
commit
c45c7d64dc
2 changed files with 16 additions and 1 deletions
|
@ -415,6 +415,21 @@ describe('SharingMetaFields', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('Should convert to absolute correctly', () => {
|
||||
jest.useFakeTimers().setSystemTime(new Date('2024-10-21T10:19:31.254Z'));
|
||||
|
||||
const from = 'now-1d/d';
|
||||
const to = 'now-1d/d';
|
||||
const component = <SharingMetaFields from={from} to={to} dateFormat="MMM D, YYYY @ HH:mm:ss" />;
|
||||
|
||||
expect(shallow(component)).toMatchInlineSnapshot(`
|
||||
<div
|
||||
data-shared-timefilter-duration="Oct 20, 2024 @ 00:00:00 to Oct 20, 2024 @ 23:59:59"
|
||||
data-test-subj="dataSharedTimefilterDuration"
|
||||
/>
|
||||
`);
|
||||
});
|
||||
|
||||
it('Should render the component without data-shared-timefilter-duration if time is not set correctly', () => {
|
||||
const component = (
|
||||
<SharingMetaFields from="boom" to="now" dateFormat="MMM D, YYYY @ HH:mm:ss.SSS" />
|
||||
|
|
|
@ -209,7 +209,7 @@ export const SharingMetaFields = React.memo(function SharingMetaFields({
|
|||
try {
|
||||
const dateRangePretty = usePrettyDuration({
|
||||
timeFrom: toAbsoluteString(from),
|
||||
timeTo: toAbsoluteString(to),
|
||||
timeTo: toAbsoluteString(to, true),
|
||||
quickRanges: [],
|
||||
dateFormat,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue