浏览代码

fix date in pwd table

amenpunk 2 年之前
父节点
当前提交
9af397d89b
共有 2 个文件被更改,包括 16 次插入9 次删除
  1. 3 0
      src/Components/Password/Operation.jsx
  2. 13 9
      src/Components/Password/Rows.js

+ 3 - 0
src/Components/Password/Operation.jsx

291
 
291
 
292
             <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
292
             <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
293
               <TextField
293
               <TextField
294
+                label="Nombre de la Contraseña"
295
+                fullWidth
296
+                variant="filled"
294
                 value={password ? atob(password.pwd) : ""}
297
                 value={password ? atob(password.pwd) : ""}
295
                 type="text"
298
                 type="text"
296
                 disabled
299
                 disabled

+ 13 - 9
src/Components/Password/Rows.js

1
-function fromBase64(text){
2
-  try{
1
+function fromBase64(text) {
2
+  try {
3
     return atob(text)
3
     return atob(text)
4
-  }catch(_e){
4
+  } catch (_e) {
5
     return text
5
     return text
6
   }
6
   }
7
 }
7
 }
12
     name: 'id',
12
     name: 'id',
13
     numeric: true,
13
     numeric: true,
14
     label: 'ID',
14
     label: 'ID',
15
-    options:{
16
-      display:false
15
+    options: {
16
+      display: false
17
     }
17
     }
18
   },
18
   },
19
   {
19
   {
60
 ]
60
 ]
61
 
61
 
62
 export function Build(pwds) {
62
 export function Build(pwds) {
63
+
64
+  const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
65
+  //NOTE:
66
+  //js year formt yyyy/mm/dd
63
   return pwds.map(password => {
67
   return pwds.map(password => {
64
-    let { pwd, plaza_id,deadpwd,dateToActived } = password
68
+    let { pwd, plaza_id, deadpwd, dateToActived } = password
65
     return {
69
     return {
66
       id: plaza_id,
70
       id: plaza_id,
67
-      name: fromBase64( pwd ),
68
-      activacion: dateToActived,//new Date( dateToActived ), 
69
-      dead: deadpwd //new Date( deadpwd ),
71
+      name: fromBase64(pwd),
72
+      activacion: dateToActived ? new Date(dateToActived).toLocaleDateString('es-GT',options) : "",//new Date( dateToActived ), 
73
+      dead: deadpwd ? new Date(deadpwd).toLocaleDateString('es-GT', options) : ""   //new Date( deadpwd ),
70
     }
74
     }
71
   })
75
   })
72
 }
76
 }