Browse Source

hello jalali date and time

ssr
Artemis 6 months ago
parent
commit
568f3e42bb
9 changed files with 110 additions and 178 deletions
  1. +94
    -164
      package-lock.json
  2. +1
    -0
      package.json
  3. +10
    -1
      src/core/core.service.ts
  4. +1
    -2
      src/routes/funds/one/one.component.ts
  5. +1
    -2
      src/routes/panel/components/menu/menu.component.ts
  6. +1
    -2
      src/routes/panel/components/states/states.component.ts
  7. +1
    -1
      src/routes/panel/components/transactions-table/transactions-table.component.html
  8. +0
    -6
      src/routes/panel/components/transactions-table/transactions-table.component.ts
  9. +1
    -0
      tsconfig.json

+ 94
- 164
package-lock.json
File diff suppressed because it is too large
View File


+ 1
- 0
package.json View File

@ -18,6 +18,7 @@
"@angular/platform-browser": "~13.1.0",
"@angular/platform-browser-dynamic": "~13.1.0",
"@angular/router": "~13.1.0",
"jalali-moment": "^3.3.11",
"libphonenumber-js": "^1.9.44",
"qrcode-generator": "^1.4.4",
"rxjs": "~7.4.0",

+ 10
- 1
src/core/core.service.ts View File

@ -1,5 +1,6 @@
import { EventEmitter, Injectable } from '@angular/core';
import { Router } from '@angular/router';
import moment from 'jalali-moment'
import { IAuthProfileResponse, IFundType, Transactions, Wallets } from '../api/api.interface';
import { ApiService } from '../api/api.service';
import { INetwork } from '../api/system/api.system.interface';
@ -115,7 +116,15 @@ export class CoreService {
this.FundTypes = await this._ApiService.Fund.Type()
this.FundTypesChange.emit()
} catch (error) {
this.Toast('خطا در دریافت شبکه ها رخ داد')
this.Toast('خطا در دریافت صندوق ها رخ داد')
}
}
public DateOf(value: string | number | Date): string {
return moment(value).locale('fa').format('YYYY/MM/DD')
}
public DateTimeOf(value: string | number | Date): string {
return moment(value).locale('fa').format('YYYY/MM/DD hh:mm')
}
}

+ 1
- 2
src/routes/funds/one/one.component.ts View File

@ -15,8 +15,7 @@ export class OneComponent implements OnInit {
public get StartAt(): string {
if (!this.Item) return '-'
let date = new Date(this.Item.init_date)
return `${date.getDate() + 1}/${date.getMonth() + 1}/${date.getFullYear()}`
return this._CoreService.DateOf(this.Item.init_date)
}
public get Type(): string {

+ 1
- 2
src/routes/panel/components/menu/menu.component.ts View File

@ -24,8 +24,7 @@ export class MenuComponent implements OnInit {
public get LockedAt(): string {
if (!this._CoreService.Wallets[0]) return '-'
let date = new Date(this._CoreService.Wallets[0].last_locked_at)
return `${date.getDate() + 1}/${date.getMonth() + 1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}`
return this._CoreService.DateTimeOf(this._CoreService.Wallets[0].last_locked_at)
}
public get Status(): string {

+ 1
- 2
src/routes/panel/components/states/states.component.ts View File

@ -19,8 +19,7 @@ export class StatesComponent implements OnInit {
public get LockedAt(): string {
if (!this._CoreService.Wallets[0]) return '-'
let date = new Date(this._CoreService.Wallets[0].last_locked_at)
return `${date.getDate() + 1}/${date.getMonth() + 1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}`
return this._CoreService.DateTimeOf(this._CoreService.Wallets[0].last_locked_at)
}
constructor(private _CoreService: CoreService) { }

+ 1
- 1
src/routes/panel/components/transactions-table/transactions-table.component.html View File

@ -31,7 +31,7 @@
<td>{{item.fee}}</td>
<td class="address">{{item.type == 'deposit' ? item.tx_id : item.wallet}}</td>
</ng-container>
<td>{{DateOf(item.created_at)}}</td>
<td>{{CoreService.DateTimeOf(item.created_at)}}</td>
</tr>
</tbody>
</table>

+ 0
- 6
src/routes/panel/components/transactions-table/transactions-table.component.ts View File

@ -23,10 +23,4 @@ export class TransactionsTableComponent implements OnInit {
ngOnInit(): void {
}
public DateOf(from: Date | number): string {
let date = new Date(from)
return `${date.getDate() + 1}/${date.getMonth() + 1}/${date.getFullYear()} ${date.getHours()}:${date.getMinutes()}`
}
}

+ 1
- 0
tsconfig.json View File

@ -2,6 +2,7 @@
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,

Loading…
Cancel
Save