Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MC-21331 Intl.DateTimeFormat returns different format #19

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Lint pyrene
run: (cd pyrene && npm install && npm run lint)
tuktuktwo:
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Lint tuktuktwo
run: (cd tuktuktwo && npm install && npm run lint)
pyrene-graphs:
Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Lint pyrene-graphs
run: (cd pyrene-graphs && npm install && npm run lint)
kitchensink:
Expand All @@ -41,6 +41,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Lint kitchensink
run: (cd kitchensink && npm install && npm run lint)
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Test pyrene
run: (cd pyrene && npm install && npm test)
- name: Build pyrene
Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Test tuktuktwo
run: (cd tuktuktwo && npm install && npm test)
- name: Build tuktuktwo
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14'
node-version: '12'
- name: Test pyrene-graphs
run: (cd pyrene-graphs && npm install && npm test)
- name: Build pyrene-graphs
Expand Down
7 changes: 3 additions & 4 deletions pyrene/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyrene/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"babel-plugin-typescript-to-proptypes": "^1.4.1",
"copy-webpack-plugin": "^6.2.0",
"css-loader": "^3.6.0",
"date-fns-tz": "^1.1.3",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^7.10.0",
Expand Down Expand Up @@ -99,6 +98,7 @@
"dependencies": {
"classnames": "^2.2.5",
"date-fns": "^2.16.1",
"date-fns-tz": "^1.1.4",
"prop-types": "^15.6.1",
"react-select": "^3.1.1",
"react-table": "^6.8.6",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';

import { differenceInMinutes } from 'date-fns';
import { differenceInMinutes, getTime, format } from 'date-fns';
import { utcToZonedTime } from 'date-fns-tz';


import ArrowSelector from './ArrowSelector/ArrowSelector';

Expand All @@ -25,14 +27,12 @@ const TimeRangeNavigationBar = (props) => {
);
};

/* eslint-disable-next-line react/display-name */
TimeRangeNavigationBar.renderCurrentTimeRange = (from, to, timezone) => {
const localFrom = getTime(utcToZonedTime(new Date(from), timezone));
const localTo = getTime(utcToZonedTime(new Date(to), timezone));
const pattern = 'dd.MM.yyyy, HH:mm';

const locale = new Intl.DateTimeFormat('de', {
timeZone: timezone, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit',
});

return `${locale.format(from)} - ${locale.format(to)}`;
return `${format(localFrom, pattern)} - ${format(localTo, pattern)}`;
};

TimeRangeNavigationBar.defaultProps = {
Expand Down