MOBILE-2458 calendar: Use "1 hour" and "1 day" in settings

main
Albert Gasset 2018-06-28 10:57:06 +02:00
parent ef20b3c3dd
commit 6221f84d96
2 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom';
import { CoreSitesProvider } from '@providers/sites';
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
import { CoreCourseProvider } from '@core/course/providers/course';
import * as moment from 'moment';
import { CoreTimeUtilsProvider } from '@providers/utils/time';
/**
* Page that displays a single calendar event.
@ -46,7 +46,7 @@ export class AddonCalendarEventPage {
notificationsEnabled = false;
constructor(private translate: TranslateService, private calendarProvider: AddonCalendarProvider, navParams: NavParams,
private domUtils: CoreDomUtilsProvider, private coursesProvider: CoreCoursesProvider,
private domUtils: CoreDomUtilsProvider, private coursesProvider: CoreCoursesProvider, timeUtils: CoreTimeUtilsProvider,
private calendarHelper: AddonCalendarHelperProvider, sitesProvider: CoreSitesProvider,
localNotificationsProvider: CoreLocalNotificationsProvider, private courseProvider: CoreCourseProvider) {
@ -63,7 +63,7 @@ export class AddonCalendarEventPage {
// Disabled by default.
this.defaultTimeReadable = this.translate.instant('core.settings.disabled');
} else {
this.defaultTimeReadable = moment.duration(defaultTime * 60 * 1000).humanize();
this.defaultTimeReadable = timeUtils.formatTime(defaultTime * 60);
}
});
}

View File

@ -14,7 +14,7 @@
import { Pipe, PipeTransform } from '@angular/core';
import { CoreLoggerProvider } from '@providers/logger';
import * as moment from 'moment';
import { CoreTimeUtilsProvider } from '@providers/utils/time';
/**
* Filter to turn a number of seconds to a duration. E.g. 60 -> 1 minute.
@ -25,7 +25,7 @@ import * as moment from 'moment';
export class CoreDurationPipe implements PipeTransform {
protected logger;
constructor(logger: CoreLoggerProvider) {
constructor(logger: CoreLoggerProvider, private timeUtils: CoreTimeUtilsProvider) {
this.logger = logger.getInstance('CoreBytesToSizePipe');
}
@ -47,6 +47,6 @@ export class CoreDurationPipe implements PipeTransform {
seconds = numberSeconds;
}
return moment.duration(seconds * 1000).humanize();
return this.timeUtils.formatTime(seconds);
}
}