Selaa lähdekoodia

date format - jalalian

mhsanaei 4 kuukautta sitten
vanhempi
commit
76fdfb2ef2

+ 6 - 1
web/assets/js/util/date-util.js

@@ -128,7 +128,7 @@ Date.prototype.formatDateTime = function (split = ' ') {
 };
 
 class DateUtil {
-    // String string to date object
+    // String to date object
     static parseDate(str) {
         return new Date(str.replace(/-/g, '/'));
     }
@@ -143,4 +143,9 @@ class DateUtil {
         date.setMinTime();
         return date;
     }
+
+    static convertToJalalian(date) {
+        return date && moment.isMoment(date) ? date.format('jYYYY/jMM/jDD HH:mm:ss') : null;
+    }
+
 }

+ 3 - 2
web/html/xui/client_bulk_modal.html

@@ -108,15 +108,16 @@
                 format="YYYY-MM-DD HH:mm:ss" :dropdown-class-name="themeSwitcher.currentTheme"
                 v-model="clientsBulkModal.expiryTime"></a-date-picker>
             <persian-datepicker v-else placeholder='{{ i18n "pages.settings.datepickerPlaceholder" }}'
-                value="clientsBulkModal.expiryTime" v-model="clientsBulkModal.expiryTime"></persian-datepicker>
+                value="clientsBulkModal.expiryTime" v-model="clientsBulkModal.expiryTime">
+            </persian-datepicker>
         </a-form-item>
         <a-form-item v-if="clientsBulkModal.expiryTime != 0">
             <template slot="label">
-                <span>{{ i18n "pages.client.renew" }}</span>
                 <a-tooltip>
                     <template slot="title">
                         <span>{{ i18n "pages.client.renewDesc" }}</span>
                     </template>
+                    {{ i18n "pages.client.renew" }}
                     <a-icon type="question-circle"></a-icon>
                 </a-tooltip>
             </template>

+ 7 - 6
web/html/xui/form/inbound.html

@@ -54,12 +54,13 @@
                 <a-icon type="question-circle"></a-icon>
             </a-tooltip>
         </template>
-            <a-date-picker style="width: 100%;" v-if="datepicker == 'gregorian'" :show-time="{ format: 'HH:mm:ss' }" format="YYYY-MM-DD HH:mm:ss"
-                :dropdown-class-name="themeSwitcher.currentTheme"
-                v-model="dbInbound._expiryTime"></a-date-picker>
-            <persian-datepicker v-else placeholder='{{ i18n "pages.settings.datepickerPlaceholder" }}'
-                            value="dbInbound._expiryTime" v-model="dbInbound._expiryTime"></persian-datepicker>
-        </a-form-item>
+        <a-date-picker style="width: 100%;" v-if="datepicker == 'gregorian'" :show-time="{ format: 'HH:mm:ss' }"
+            format="YYYY-MM-DD HH:mm:ss" :dropdown-class-name="themeSwitcher.currentTheme"
+            v-model="dbInbound._expiryTime"></a-date-picker>
+        <persian-datepicker v-else placeholder='{{ i18n "pages.settings.datepickerPlaceholder" }}'
+            value="dbInbound._expiryTime" v-model="dbInbound._expiryTime">
+        </persian-datepicker>
+    </a-form-item>
 </a-form>
 
 <!-- vmess settings -->

+ 32 - 4
web/html/xui/inbound_client_table.html

@@ -90,7 +90,14 @@
       <template slot="content">
         <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
         </span>
-        <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
+        <span v-else>
+          <template v-if="app.datepicker === 'gregorian'">
+            [[ DateUtil.formatMillis(client._expiryTime) ]]
+          </template>
+          <template v-else>
+            [[ DateUtil.convertToJalalian(moment(client._expiryTime)) ]]
+          </template>
+        </span>
       </template>
       <table>
         <tr class="tr-table-box">
@@ -108,7 +115,14 @@
       <template slot="content">
         <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
         </span>
-        <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
+        <span v-else>
+          <template v-if="app.datepicker === 'gregorian'">
+            [[ DateUtil.formatMillis(client._expiryTime) ]]
+          </template>
+          <template v-else>
+            [[ DateUtil.convertToJalalian(moment(client._expiryTime)) ]]
+          </template>
+        </span>
       </template>
       <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)"> [[ remainedDays(client.expiryTime) ]] </a-tag>
     </a-popover>
@@ -201,7 +215,14 @@
                 <template slot="content">
                   <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
                   </span>
-                  <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
+                  <span v-else>
+                    <template v-if="app.datepicker === 'gregorian'">
+                      [[ DateUtil.formatMillis(client._expiryTime) ]]
+                    </template>
+                    <template v-else>
+                      [[ DateUtil.convertToJalalian(moment(client._expiryTime)) ]]
+                    </template>
+                  </span>
                 </template>
                 <a-progress :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
               </a-popover>
@@ -214,7 +235,14 @@
                 <template slot="content">
                   <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
                   </span>
-                  <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
+                  <span v-else>
+                    <template v-if="app.datepicker === 'gregorian'">
+                      [[ DateUtil.formatMillis(client._expiryTime) ]]
+                    </template>
+                    <template v-else>
+                      [[ DateUtil.convertToJalalian(moment(client._expiryTime)) ]]
+                    </template>
+                  </span>
                 </template>
                 <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)"> [[ remainedDays(client.expiryTime) ]] </a-tag>
               </a-popover>

+ 8 - 1
web/html/xui/inbound_info_modal.html

@@ -221,7 +221,14 @@
           </td>
           <td>
             <template v-if="infoModal.clientSettings.expiryTime > 0">
-              <a-tag :color="usageColor(new Date().getTime(), app.expireDiff, infoModal.clientSettings.expiryTime)"> [[ DateUtil.formatMillis(infoModal.clientSettings.expiryTime) ]] </a-tag>
+              <a-tag :color="usageColor(new Date().getTime(), app.expireDiff, infoModal.clientSettings.expiryTime)"> 
+                <template v-if="app.datepicker === 'gregorian'">
+                  [[ DateUtil.formatMillis(infoModal.clientSettings.expiryTime) ]]
+                </template>
+                <template v-else>
+                  [[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.expiryTime)) ]]
+                </template>
+              </a-tag>
             </template>
             <a-tag v-else-if="infoModal.clientSettings.expiryTime < 0" color="green">[[ infoModal.clientSettings.expiryTime / -86400000 ]] {{ i18n "pages.client.days" }}
             </a-tag>

+ 12 - 3
web/html/xui/inbounds.html

@@ -403,9 +403,12 @@
               </template>
               <template slot="expiryTime" slot-scope="text, dbInbound">
                 <a-popover v-if="dbInbound.expiryTime > 0" :overlay-class-name="themeSwitcher.currentTheme">
-                  <template slot="content">
+                  <template slot="content" v-if="app.datepicker === 'gregorian'">
                     [[ DateUtil.formatMillis(dbInbound.expiryTime) ]]
                   </template>
+                  <template v-else slot="content">
+                    [[ DateUtil.convertToJalalian(moment(dbInbound.expiryTime)) ]]
+                  </template>
                   <a-tag style="min-width: 50px;" :color="usageColor(new Date().getTime(), app.expireDiff, dbInbound._expiryTime)">
                     [[ remainedDays(dbInbound._expiryTime) ]]
                   </a-tag>
@@ -498,8 +501,14 @@
                       <tr>
                         <td>{{ i18n "pages.inbounds.expireDate" }}</td>
                         <td>
-                          <a-tag style="min-width: 50px; text-align: center;" v-if="dbInbound.expiryTime > 0" :color="dbInbound.isExpiry? 'red': 'blue'">
-                            [[ DateUtil.formatMillis(dbInbound.expiryTime) ]]
+                          <a-tag style="min-width: 50px; text-align: center;" v-if="dbInbound.expiryTime > 0"
+                            :color="dbInbound.isExpiry? 'red': 'blue'">
+                            <template v-if="app.datepicker === 'gregorian'">
+                              [[ DateUtil.formatMillis(dbInbound.expiryTime) ]]
+                            </template>
+                            <template v-else>
+                              [[ DateUtil.convertToJalalian(moment(dbInbound.expiryTime)) ]]
+                            </template>
                           </a-tag>
                           <a-tag v-else style="text-align: center;" color="purple" class="infinite-tag">
                             <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">