浏览代码

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

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

@@ -1,7 +1,7 @@
1
-function fromBase64(text){
2
-  try{
1
+function fromBase64(text) {
2
+  try {
3 3
     return atob(text)
4
-  }catch(_e){
4
+  } catch (_e) {
5 5
     return text
6 6
   }
7 7
 }
@@ -12,8 +12,8 @@ export const Encabezados = [
12 12
     name: 'id',
13 13
     numeric: true,
14 14
     label: 'ID',
15
-    options:{
16
-      display:false
15
+    options: {
16
+      display: false
17 17
     }
18 18
   },
19 19
   {
@@ -60,13 +60,17 @@ export const niveles_educativos = [
60 60
 ]
61 61
 
62 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 67
   return pwds.map(password => {
64
-    let { pwd, plaza_id,deadpwd,dateToActived } = password
68
+    let { pwd, plaza_id, deadpwd, dateToActived } = password
65 69
     return {
66 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
 }