Skip to content

Commit

Permalink
Merge pull request #825 from CorrelAid/824-fix-messy-event-info-layou…
Browse files Browse the repository at this point in the history
…t-in-english

event single page: abbreviate month | close #824
  • Loading branch information
jstet authored Oct 18, 2024
2 parents 6b96e68 + ae6c3fd commit e0230a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ export function genImageSrc(id, transform = '') {
*/
export function toLocalDateString(date, locale, year = false) {
let options = {
month: 'long',
month: 'short',
day: 'numeric',
};
if (year) {
options = {
month: 'long',
month: 'short',
day: 'numeric',
year: 'numeric',
};
Expand Down
8 changes: 4 additions & 4 deletions src/lib/js/helpers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe('helper functions', () => {
test('genDate', () => {
const date = '2023-04-28T00:20:00';

expect(genDate(date, 'de', true)).toBe('28. April 2023');
expect(genDate(date, 'en', true)).toBe('April 28, 2023');
expect(genDate(date, 'de', false)).toBe('28. April');
expect(genDate(date, 'en', false)).toBe('April 28');
expect(genDate(date, 'de', true)).toBe('28. Apr. 2023');
expect(genDate(date, 'en', true)).toBe('Apr 28, 2023');
expect(genDate(date, 'de', false)).toBe('28. Apr.');
expect(genDate(date, 'en', false)).toBe('Apr 28');

const date2 = '2023-05-01T00:00:00';

Expand Down

0 comments on commit e0230a6

Please sign in to comment.