Skip to content

Commit

Permalink
fix(ui): harmonize utc labels (#1403)
Browse files Browse the repository at this point in the history
close #1400

Co-authored-by: Fredrik Lysén <[email protected]>
  • Loading branch information
2 people authored and tchiotludo committed Apr 4, 2023
1 parent b021966 commit 301937c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class ConsumerGroupUpdate extends Form {
style={{ marginRight: '0.5rem', padding: 0 }}
>
<Dropdown>
<Dropdown.Toggle>Filter datetime</Dropdown.Toggle>
<Dropdown.Toggle>Filter Timestamp UTC</Dropdown.Toggle>
{!loading && (
<Dropdown.Menu>
<div>
Expand Down
7 changes: 3 additions & 4 deletions client/src/containers/Topic/Topic/TopicData/TopicData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ class TopicData extends Root {
second: timestamp.second(),
milli: timestamp.millisecond()
},
'YYYY-MM-DDTHH:mm:ss.SSS',
true
'YYYY-MM-DDTHH:mm:ss.SSS'
) + 'Z';
filters.push(`timestamp=${timestamp}`);
}
Expand Down Expand Up @@ -831,7 +830,7 @@ class TopicData extends Root {
<li className="nav-item dropdown">
<Dropdown>
<Dropdown.Toggle className="nav-link dropdown-toggle">
<strong>Timestamp:</strong>
<strong>Timestamp UTC:</strong>
{datetime !== '' &&
' ' +
formatDateTime(
Expand Down Expand Up @@ -1012,7 +1011,7 @@ class TopicData extends Root {
{
id: 'timestamp',
accessor: 'timestamp',
colName: 'Date',
colName: 'Timestamp',
type: 'text',
cell: (obj, col) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Topic/TopicCopy/TopicCopy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class TopicCopy extends Form {
style={{ marginRight: '0.5rem', padding: 0 }}
>
<Dropdown>
<Dropdown.Toggle>Filter datetime</Dropdown.Toggle>
<Dropdown.Toggle>Filter Timestamp UTC</Dropdown.Toggle>
{!loading && (
<Dropdown.Menu>
<div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/Topic/TopicProduce/TopicProduce.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ class TopicProduce extends Form {
style={{ padding: 0, alignItems: 'center', display: 'flex' }}
className="col-sm-2 col-form-label"
>
Timestamp
Timestamp UTC
</label>
<Dropdown style={{ width: '100%', padding: 0, margin: 0 }}>
<Dropdown.Toggle
Expand Down
8 changes: 7 additions & 1 deletion client/src/utils/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ export function groupedTopicOffset(offsets) {
}, Object.create(null));
}

export function formatDateTime(value, format, utc = false) {
/**
* If the utc parameter is true (which is the default value),
* the date and time will be converted to UTC time before formatting.
* If utc is false, the date and time will be formatted in the local time zone.
* Finally, the formatted date and time string is returned as a string
*/
export function formatDateTime(value, format, utc = true) {
let milli = value.milli || 0;
const date = new Date(
value.year,
Expand Down

0 comments on commit 301937c

Please sign in to comment.