Skip to content

Commit

Permalink
fix: display dates in the user's timezone, if no timezone is given (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber authored and shauke committed Jan 31, 2024
1 parent 7e6c02c commit 33ff2fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/core/pipes/date.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ describe('Date Pipe', () => {
`('should transform $date to', ({ date, format, EN, DE }) => {
test(`${EN} with format ${format} for english local`, () => {
translateService.use('en');
expect(datePipe.transform(date, format)).toEqual(EN);
expect(datePipe.transform(date, format, '+0000')).toEqual(EN);
});
test(`${DE} with format ${format} for german locale`, () => {
translateService.use('de');
expect(datePipe.transform(date, format)).toEqual(DE);
expect(datePipe.transform(date, format, '+0000')).toEqual(DE);
});
});
});
3 changes: 2 additions & 1 deletion src/app/core/pipes/date.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function formatISHDate(
} else {
date = value;
}
return formatDate(date, format, lang, timezone || '+0000');
// if no time zone is given take the user's current time zone
return formatDate(date, format, lang, timezone);
}

/**
Expand Down

0 comments on commit 33ff2fc

Please sign in to comment.