Skip to content

Fix "now" and mixed format date handling in share modal#245539

Merged
kowalczyk-krzysztof merged 7 commits intoelastic:mainfrom
kowalczyk-krzysztof:fix/share-modal-date-picker-fix
Dec 10, 2025
Merged

Fix "now" and mixed format date handling in share modal#245539
kowalczyk-krzysztof merged 7 commits intoelastic:mainfrom
kowalczyk-krzysztof:fix/share-modal-date-picker-fix

Conversation

@kowalczyk-krzysztof
Copy link
Member

@kowalczyk-krzysztof kowalczyk-krzysztof commented Dec 8, 2025

Summary

This PR fixes a bug where mixed dates (e.g one absolute and one relative) wouldn't work properly and "now" was rendering as 0 seconds in share modal date switcher.

Screenshot 2025-12-09 at 13 13 05

It also makes ShareableUrlLocatorParams strongly typed, requiring timeRange to be always present even if it has an undefined value, in response to a regression where dashboard time range parameter name was renamed to be snake_case, which broke the functionality as TimeTypeSection would always expect timeRange.

Closes: #241084

@kowalczyk-krzysztof kowalczyk-krzysztof self-assigned this Dec 8, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof added the bug Fixes for quality problems that affect the customer experience label Dec 8, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof requested a review from a team as a code owner December 8, 2025 15:01
@kowalczyk-krzysztof kowalczyk-krzysztof added release_note:fix backport:all-open Backport to all branches that could still receive a release labels Dec 8, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof added papercut Small "burr" in the product that we should fix. Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// labels Dec 8, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@kowalczyk-krzysztof kowalczyk-krzysztof requested review from a team as code owners December 9, 2025 12:10
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kibana-presentation changes LGTM. Thanks for fixing this issue
code review only

Copy link
Contributor

@akowalska622 akowalska622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data Discovery code only review LGTM

@kowalczyk-krzysztof kowalczyk-krzysztof enabled auto-merge (squash) December 9, 2025 15:53
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
share 95 96 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 702.7KB 702.8KB +28.0B
discover 1.3MB 1.3MB +15.0B
total +43.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
share 53.8KB 53.1KB -694.0B
Unknown metric groups

API count

id before after diff
share 161 162 +1

History

cc @kowalczyk-krzysztof

Copy link
Contributor

@eokoneyo eokoneyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes LGTM, left a comment

Comment on lines +128 to +136
const handleTimeTypeChange = useCallback(
(isAbsolute: boolean) => {
if (urlToCopy?.current && isAbsolute !== isAbsoluteTime) {
urlToCopy.current = undefined;
}
setIsAbsoluteTime(isAbsolute);
},
[isAbsoluteTime]
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could improve this further, such that we simply pass the setIsAbsolute method to onTimeTypeChange and then react to changes to it's value to set urlToCopy only within the context it was defined, your call.

@kowalczyk-krzysztof kowalczyk-krzysztof merged commit bae752e into elastic:main Dec 10, 2025
13 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19, 9.1, 9.2

https://github.com/elastic/kibana/actions/runs/20101528529

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts
9.1 Backport failed because of merge conflicts
9.2 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 245539

Questions ?

Please refer to the Backport tool documentation

@kowalczyk-krzysztof
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kowalczyk-krzysztof added a commit to kowalczyk-krzysztof/kibana that referenced this pull request Dec 10, 2025
## Summary

This PR fixes a bug where mixed dates (e.g one absolute and one
relative) wouldn't work properly and "now" was rendering as 0 seconds in
share modal date switcher.

<img width="494" height="432" alt="Screenshot 2025-12-09 at 13 13 05"
src="https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a"
/>

It also makes `ShareableUrlLocatorParams` strongly typed, requiring
`timeRange` to be always present even if it has an undefined value, in
response to a regression where dashboard time range parameter name was
renamed to be snake_case, which broke the functionality as
`TimeTypeSection` would always expect `timeRange`.

Closes: elastic#241084

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit bae752e)

# Conflicts:
#	src/platform/plugins/shared/discover/public/application/main/components/top_nav/app_menu_actions/get_share.tsx
#	src/platform/plugins/shared/share/moon.yml
@kowalczyk-krzysztof
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kowalczyk-krzysztof
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kowalczyk-krzysztof added a commit to kowalczyk-krzysztof/kibana that referenced this pull request Dec 10, 2025
## Summary

This PR fixes a bug where mixed dates (e.g one absolute and one
relative) wouldn't work properly and "now" was rendering as 0 seconds in
share modal date switcher.

<img width="494" height="432" alt="Screenshot 2025-12-09 at 13 13 05"
src="https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a"
/>

It also makes `ShareableUrlLocatorParams` strongly typed, requiring
`timeRange` to be always present even if it has an undefined value, in
response to a regression where dashboard time range parameter name was
renamed to be snake_case, which broke the functionality as
`TimeTypeSection` would always expect `timeRange`.

Closes: elastic#241084

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit bae752e)

# Conflicts:
#	src/platform/plugins/shared/discover/public/application/main/components/top_nav/app_menu_actions/get_share.tsx
#	src/platform/plugins/shared/share/moon.yml
#	src/platform/plugins/shared/share/public/components/share_context_menu.tsx
#	src/platform/plugins/shared/share/public/components/tabs/link/time_type_section.tsx
#	src/platform/plugins/shared/share/public/components/url_panel_content.tsx
#	src/platform/plugins/shared/share/tsconfig.json
kowalczyk-krzysztof added a commit that referenced this pull request Dec 10, 2025
…) (#245846)

# Backport

This will backport the following commits from `main` to `8.19`:
- [Fix "now" and mixed format date handling in share modal
(#245539)](#245539)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Krzysztof
Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix
\"now\" and mixed format date handling in share
modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},{"url":"https://github.com/elastic/kibana/pull/245841","number":245841,"branch":"9.2","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/245845","number":245845,"branch":"9.1","state":"OPEN"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kowalczyk-krzysztof added a commit that referenced this pull request Dec 10, 2025
… (#245841)

# Backport

This will backport the following commits from `main` to `9.2`:
- [Fix "now" and mixed format date handling in share modal
(#245539)](#245539)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Krzysztof
Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix
\"now\" and mixed format date handling in share
modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}}]}]
BACKPORT-->
kowalczyk-krzysztof added a commit that referenced this pull request Dec 10, 2025
… (#245845)

# Backport

This will backport the following commits from `main` to `9.1`:
- [Fix "now" and mixed format date handling in share modal
(#245539)](#245539)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Krzysztof
Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix
\"now\" and mixed format date handling in share
modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix
\"now\" and mixed format date handling in share modal (#245539)\n\n##
Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and
one\nrelative) wouldn't work properly and \"now\" was rendering as 0
seconds in\nshare modal date switcher.\n\n<img width=\"494\"
height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13
05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt
also makes `ShareableUrlLocatorParams` strongly typed,
requiring\n`timeRange` to be always present even if it has an undefined
value, in\nresponse to a regression where dashboard time range parameter
name was\nrenamed to be snake_case, which broke the functionality
as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses:
https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},{"url":"https://github.com/elastic/kibana/pull/245841","number":245841,"branch":"9.2","state":"OPEN"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kowalczyk-krzysztof kowalczyk-krzysztof deleted the fix/share-modal-date-picker-fix branch December 10, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release bug Fixes for quality problems that affect the customer experience papercut Small "burr" in the product that we should fix. release_note:fix Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v8.19.9 v9.1.9 v9.2.3 v9.3.0

6 participants