Skip to content

Commit

Permalink
fix(scopes): Use locale for hour scope, not minute scope
Browse files Browse the repository at this point in the history
Minutes will be the same for all locales.
Hours can difer (AM/PM, 24h format, ...)
  • Loading branch information
klinki committed Mar 24, 2018
1 parent fb764c8 commit 405844e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/scope/hour-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class HourScope extends AbstractScope {
return hours;
}

public formatDate(date: Date): string {
public formatDate(date: Date, locale?: any): string {
return formatDate(date, 'HH');
}

Expand Down
2 changes: 1 addition & 1 deletion src/scope/minute-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class MinuteScope extends AbstractScope {
return minutes;
}

public formatDate(date: Date, locale?: any): string {
public formatDate(date: Date): string {
return formatDate(date, 'mm');
}

Expand Down
7 changes: 0 additions & 7 deletions test/scope/minute-scope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ describe('MinuteScope', () => {
expect(result).toBe('59');
});

it('formatDate should respect locale', () => {
const locale = undefined;
const result = scope.formatDate(date, locale);
expect(result).toBe('59');
});


it('title should return year', () => {
const result = scope.title(date);
expect(result).toBe('24. 04. 2018');
Expand Down

0 comments on commit 405844e

Please sign in to comment.