22import { api , environment } from '../lib/environment' ;
33import { Utils } from '../lib/Utils' ;
44import { ProfileOperations } from './ProfileOperations' ;
5- import { Debug } from '../lib/Debug' ;
65
76/*
87 * This file is part of SmartProxy <https://github.com/salarcode/SmartProxy>,
@@ -956,17 +955,19 @@ export enum ProxyServerSubscriptionFormat {
956955export class SubscriptionStats {
957956 lastSuccessDate : string ;
958957 lastTryDate : string ;
958+ lastTryIsoDate : string ;
959959 lastStatus : boolean ;
960960 lastStatusMessage : string ;
961961 lastStatusProxyServerName : string ;
962962
963963 public static updateStats ( stats : SubscriptionStats , success : boolean , errorResult ?: any ) {
964964 let now = new Date ( ) ;
965- stats . lastTryDate = now . toISOString ( ) ;
965+ stats . lastTryIsoDate = now . toISOString ( ) ;
966+ stats . lastTryDate = now . toLocaleDateString ( ) + ' ' + now . toLocaleTimeString ( ) ;
966967 if ( success ) {
967968 stats . lastStatus = true ;
968969 stats . lastStatusMessage = null ;
969- stats . lastSuccessDate = now . toLocaleDateString ( ) + ' ' + now . toLocaleTimeString ( ) ;
970+ stats . lastSuccessDate = stats . lastTryDate ;
970971 }
971972 else {
972973 stats . lastStatus = false ;
@@ -985,13 +986,7 @@ export class SubscriptionStats {
985986
986987 if ( ! stats . lastStatus ) {
987988 if ( stats . lastTryDate ) {
988- try {
989- let lastTryDate = new Date ( stats . lastTryDate ) ;
990- let lastTryDateText = lastTryDate . toLocaleDateString ( ) + ' ' + lastTryDate . toLocaleTimeString ( ) ;
991- status += `\r\n${ api . i18n . getMessage ( "settingsSubscriptionStatsLastTry" ) } ${ lastTryDateText } `
992- } catch ( error ) {
993- Debug . warn ( `SubscriptionStats.lastTryDate has invalid (probably old) value` , error ) ;
994- }
989+ status += `\r\n${ api . i18n . getMessage ( "settingsSubscriptionStatsLastTry" ) } ${ stats . lastTryDate } `
995990 }
996991 else {
997992 status += `\r\n${ api . i18n . getMessage ( "settingsSubscriptionStatsLastTry" ) } -`
0 commit comments