1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-11 22:03:27 +00:00

add date and time formatting methods to localize service (#1616)

- uses Apple APIs for formatting on iOS
- uses .Net APIs for formatting Android
- implemented across project
- remove unnecesary calls to DateTimeConverter
This commit is contained in:
Jake Fink
2021-10-28 12:52:41 -04:00
committed by GitHub
parent 397250368a
commit 83fd6736f6
9 changed files with 72 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ namespace Bit.App.Pages
private readonly IPlatformUtilsService _platformUtilsService;
private readonly IStorageService _storageService;
private readonly ISyncService _syncService;
private readonly ILocalizeService _localizeService;
private string _lastSync = "--";
private bool _inited;
@@ -25,6 +26,7 @@ namespace Bit.App.Pages
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService");
_localizeService = ServiceContainer.Resolve<ILocalizeService>("localizeService");
PageTitle = AppResources.Sync;
}
@@ -68,7 +70,9 @@ namespace Bit.App.Pages
if (last != null)
{
var localDate = last.Value.ToLocalTime();
LastSync = string.Format("{0} {1}", localDate.ToShortDateString(), localDate.ToShortTimeString());
LastSync = string.Format("{0} {1}",
_localizeService.GetLocaleShortDate(localDate),
_localizeService.GetLocaleShortTime(localDate));
}
else
{