mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-07 21:10:00 +00:00
fix(ssh/settings): formats date value according to locale rules (#10468)
This commit is contained in:
parent
af5d3b729b
commit
7ac85a329e
@ -36,7 +36,7 @@ export { TabsService, NewTabParameters, TabComponentType } from '../services/tab
|
|||||||
export { UpdaterService } from '../services/updater.service'
|
export { UpdaterService } from '../services/updater.service'
|
||||||
export { VaultService, Vault, VaultSecret, VaultFileSecret, VAULT_SECRET_TYPE_FILE, StoredVault, VaultSecretKey } from '../services/vault.service'
|
export { VaultService, Vault, VaultSecret, VaultFileSecret, VAULT_SECRET_TYPE_FILE, StoredVault, VaultSecretKey } from '../services/vault.service'
|
||||||
export { FileProvidersService } from '../services/fileProviders.service'
|
export { FileProvidersService } from '../services/fileProviders.service'
|
||||||
export { LocaleService } from '../services/locale.service'
|
export { LocaleService, TabbyFormatedDatePipe } from '../services/locale.service'
|
||||||
export { TranslateService } from '@ngx-translate/core'
|
export { TranslateService } from '@ngx-translate/core'
|
||||||
export * from '../utils'
|
export * from '../utils'
|
||||||
export { UTF8Splitter } from '../utfSplitter'
|
export { UTF8Splitter } from '../utfSplitter'
|
||||||
|
@ -43,7 +43,7 @@ import { AppService } from './services/app.service'
|
|||||||
import { ConfigService } from './services/config.service'
|
import { ConfigService } from './services/config.service'
|
||||||
import { VaultFileProvider } from './services/vault.service'
|
import { VaultFileProvider } from './services/vault.service'
|
||||||
import { HotkeysService } from './services/hotkeys.service'
|
import { HotkeysService } from './services/hotkeys.service'
|
||||||
import { CustomMissingTranslationHandler, LocaleService } from './services/locale.service'
|
import { CustomMissingTranslationHandler, LocaleService, TabbyFormatedDatePipe } from './services/locale.service'
|
||||||
import { CommandService } from './services/commands.service'
|
import { CommandService } from './services/commands.service'
|
||||||
|
|
||||||
import { NewTheme } from './theme'
|
import { NewTheme } from './theme'
|
||||||
@ -130,6 +130,7 @@ const PROVIDERS = [
|
|||||||
DropZoneDirective,
|
DropZoneDirective,
|
||||||
CdkAutoDropGroup,
|
CdkAutoDropGroup,
|
||||||
ProfileIconComponent,
|
ProfileIconComponent,
|
||||||
|
TabbyFormatedDatePipe,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
AppRootComponent,
|
AppRootComponent,
|
||||||
@ -144,6 +145,7 @@ const PROVIDERS = [
|
|||||||
TranslateModule,
|
TranslateModule,
|
||||||
CdkAutoDropGroup,
|
CdkAutoDropGroup,
|
||||||
ProfileIconComponent,
|
ProfileIconComponent,
|
||||||
|
TabbyFormatedDatePipe,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
export default class AppModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core'
|
import { Injectable, Pipe, PipeTransform } from '@angular/core'
|
||||||
import { registerLocaleData } from '@angular/common'
|
import { formatDate, registerLocaleData } from '@angular/common'
|
||||||
import { TranslateService, MissingTranslationHandler } from '@ngx-translate/core'
|
import { TranslateService, MissingTranslationHandler } from '@ngx-translate/core'
|
||||||
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler'
|
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler'
|
||||||
|
|
||||||
@ -257,3 +257,15 @@ export class LocaleService {
|
|||||||
return this.locale
|
return this.locale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'tabbyDate',
|
||||||
|
})
|
||||||
|
export class TabbyFormatedDatePipe implements PipeTransform {
|
||||||
|
|
||||||
|
constructor (private locale: LocaleService) {}
|
||||||
|
|
||||||
|
transform (date: string): string {
|
||||||
|
return formatDate(date, 'medium', this.locale.getLocale())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -67,7 +67,7 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
|
|||||||
div {{cfg.name}}
|
div {{cfg.name}}
|
||||||
small.text-muted(
|
small.text-muted(
|
||||||
translate='Modified on {date}',
|
translate='Modified on {date}',
|
||||||
[translateParams]='{date: cfg.modified_at|date:"medium"}'
|
[translateParams]='{date: cfg.modified_at|tabbyDate}'
|
||||||
)
|
)
|
||||||
.me-auto
|
.me-auto
|
||||||
button.btn.btn-link.ms-1(
|
button.btn.btn-link.ms-1(
|
||||||
|
@ -145,4 +145,5 @@ export class ConfigSyncSettingsTabComponent extends BaseComponent {
|
|||||||
openTabbyWebInfo () {
|
openTabbyWebInfo () {
|
||||||
this.platform.openExternal('https://github.com/Eugeny/tabby-web')
|
this.platform.openExternal('https://github.com/Eugeny/tabby-web')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
)
|
)
|
||||||
div(*ngFor='let release of releases')
|
div(*ngFor='let release of releases')
|
||||||
h1 {{release.name}}
|
h1 {{release.name}}
|
||||||
.text-muted {{release.version}} / {{release.date|date:'mediumDate'}}
|
.text-muted {{release.version}} / {{release.date|tabbyDate}}
|
||||||
section([fastHtmlBind]='release.content')
|
section([fastHtmlBind]='release.content')
|
||||||
|
@ -45,4 +45,5 @@ export class ReleaseNotesComponent extends BaseTabComponent {
|
|||||||
onScrolled () {
|
onScrolled () {
|
||||||
this.loadReleases(this.lastPage + 1)
|
this.loadReleases(this.lastPage + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,5 +61,5 @@
|
|||||||
div {{item.name}}
|
div {{item.name}}
|
||||||
.me-auto
|
.me-auto
|
||||||
.size(*ngIf='!item.isDirectory') {{item.size|filesize}}
|
.size(*ngIf='!item.isDirectory') {{item.size|filesize}}
|
||||||
.date {{item.modified|date:'medium'}}
|
.date {{item.modified|tabbyDate}}
|
||||||
.mode {{getModeString(item)}}
|
.mode {{getModeString(item)}}
|
||||||
|
@ -273,4 +273,5 @@ export class SFTPPanelComponent {
|
|||||||
close (): void {
|
close (): void {
|
||||||
this.closed.emit()
|
this.closed.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user