Skip to content

Commit

Permalink
fix(sbb-journey-maps): remove obsolete dot after weekday
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Oct 12, 2023
1 parent 99118eb commit 26a5344
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 41 deletions.
44 changes: 12 additions & 32 deletions src/components/sbb-journey-summary/sbb-journey-summary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,9 @@ describe('sbb-journey-summary', () => {
</div>
<div class="sbb-journey-summary__date">
<span>
<span>
Mon.
</span>
<span>
<time datetime="29 8">
29.08.2022
</time>
</span>
<time datetime="29 8">
Mo. 29.08.2022
</time>
</span>
<time>
<span class="sbb-screenreaderonly">
Expand Down Expand Up @@ -93,14 +88,9 @@ describe('sbb-journey-summary', () => {
<div>
<div class="sbb-journey-summary__date">
<span>
<span>
Mon.
</span>
<span>
<time datetime="29 8">
29.08.2022
</time>
</span>
<time datetime="29 8">
Mo. 29.08.2022
</time>
</span>
<time>
<span class="sbb-screenreaderonly">
Expand Down Expand Up @@ -135,14 +125,9 @@ describe('sbb-journey-summary', () => {
<div>
<div class="sbb-journey-summary__date">
<span>
<span>
Mon.
</span>
<span>
<time datetime="29 8">
29.08.2022
</time>
</span>
<time datetime="29 8">
Mo. 29.08.2022
</time>
</span>
<time>
<span class="sbb-screenreaderonly">
Expand All @@ -169,14 +154,9 @@ describe('sbb-journey-summary', () => {
</div>
<div class="sbb-journey-summary__date">
<span>
<span>
Mon.
</span>
<span>
<time datetime="29 8">
29.08.2022
</time>
</span>
<time datetime="29 8">
Mo. 29.08.2022
</time>
</span>
<time>
<span class="sbb-screenreaderonly">
Expand Down
19 changes: 10 additions & 9 deletions src/components/sbb-journey-summary/sbb-journey-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { InterfaceSbbJourneySummaryAttributes } from './sbb-journey-summary.cust
import { isValid, format } from 'date-fns';

import { i18nTripDuration } from '../../global/i18n';
import { durationToTime, removeTimezoneFromISOTimeString } from '../../global/datetime';
import {
durationToTime,
NativeDateAdapter,
removeTimezoneFromISOTimeString,
} from '../../global/datetime';
import {
documentLanguage,
HandlerRepository,
Expand Down Expand Up @@ -67,17 +71,14 @@ export class SbbJourneySummary implements ComponentInterface {

/** renders the date of the journey or if it is the current or next day */
private _renderJourneyStart(departureTime: Date): JSX.Element {
const dateAdapter = new NativeDateAdapter();

if (isValid(departureTime))
return (
<span>
<span>
{departureTime.toLocaleDateString(this._currentLanguage, { weekday: 'short' })}.{' '}
</span>
<span>
<time dateTime={format(departureTime, 'd') + ' ' + format(departureTime, 'M')}>
{format(departureTime, 'dd.MM.yyyy')}
</time>
</span>
<time dateTime={format(departureTime, 'd') + ' ' + format(departureTime, 'M')}>
{dateAdapter.format(departureTime).replace(',', '.')}
</time>
</span>
);
}
Expand Down

0 comments on commit 26a5344

Please sign in to comment.