change date format to days remaining

example:
kkv4fhs4: 5.00GB📊- 6 Days
far6160p: 2.00GB📊- 23 Hours
Co-Authored-By: somebodywashere <68244480+somebodywashere@users.noreply.github.com>
This commit is contained in:
MHSanaei
2023-07-19 20:37:48 +03:30
parent 0dd0ba717f
commit 56e4d13179
3 changed files with 3 additions and 7 deletions

View File

@@ -14,7 +14,6 @@ import (
"x-ui/xray"
"github.com/goccy/go-json"
ptime "github.com/yaa110/go-persian-calendar"
)
type SubService struct {
@@ -827,11 +826,11 @@ func getExpiryTime(expiryTime int64) string {
if expiryTime == 0 {
expiryString = "♾ ⏳"
} else if timeDifference > 172800 {
expiryString = fmt.Sprintf("%s ⏳", ptime.Unix((expiryTime/1000), 0).Format("yy-MM-dd hh:mm"))
expiryString = fmt.Sprintf("%d %s⏳", timeDifference/86400, "Days")
} else if expiryTime < 0 {
expiryString = fmt.Sprintf("%d ⏳", expiryTime/-86400000)
expiryString = fmt.Sprintf("%d %s⏳", expiryTime/-86400000, "Days")
} else {
expiryString = fmt.Sprintf("%s %d ⏳", "ساعت", timeDifference/3600)
expiryString = fmt.Sprintf("%d %s⏳", timeDifference/3600, "Hours")
}
return expiryString