Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
4db74d47
Commit
4db74d47
authored
Jun 20, 2018
by
Juorder Gonzalez quiñonez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix datetime for resp automatic, time all parsed with momentjs
parent
40ac230a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
28 deletions
+9
-28
form_resp_vacaciones_mailbox.jsx
src/components/mailbox/form_resp_vacaciones_mailbox.jsx
+4
-6
utils.jsx
src/utils/utils.jsx
+5
-22
No files found.
src/components/mailbox/form_resp_vacaciones_mailbox.jsx
View file @
4db74d47
...
...
@@ -93,8 +93,8 @@ export default class FormVacacionesMailbox extends React.Component {
const
{
data
}
=
props
;
const
{
attrs
}
=
data
;
const
zimbraPrefOutOfOfficeFromDate
=
Utils
.
getTSFromUTC
(
Utils
.
getUTCTime
(
attrs
.
zimbraPrefOutOfOfficeFromDate
)
);
const
zimbraPrefOutOfOfficeUntilDate
=
Utils
.
getTSFromUTC
(
Utils
.
getUTCTime
(
attrs
.
zimbraPrefOutOfOfficeUntilDate
)
);
const
zimbraPrefOutOfOfficeFromDate
=
Utils
.
getTSFromUTC
(
attrs
.
zimbraPrefOutOfOfficeFromDate
);
const
zimbraPrefOutOfOfficeUntilDate
=
Utils
.
getTSFromUTC
(
attrs
.
zimbraPrefOutOfOfficeUntilDate
);
const
nextState
=
{
zimbraPrefOutOfOfficeReplyEnabled
:
Utils
.
parseBooleanValue
(
attrs
.
zimbraPrefOutOfOfficeReplyEnabled
),
...
...
@@ -156,8 +156,7 @@ export default class FormVacacionesMailbox extends React.Component {
}
}
minDate=
{
moment
()
}
dateTime=
{
zimbraPrefOutOfOfficeFromDate
}
value=
{
zimbraPrefOutOfOfficeFromDate
}
mode=
{
'date'
}
mode=
{
'datetime'
}
showToday=
{
true
}
/>
</
div
>
...
...
@@ -181,8 +180,7 @@ export default class FormVacacionesMailbox extends React.Component {
}
}
minDate=
{
moment
()
}
dateTime=
{
zimbraPrefOutOfOfficeUntilDate
}
value=
{
zimbraPrefOutOfOfficeUntilDate
}
mode=
{
'date'
}
mode=
{
'datetime'
}
/>
</
div
>
</
div
>
...
...
src/utils/utils.jsx
View file @
4db74d47
...
...
@@ -603,9 +603,9 @@ export function getInitialDateFromTimestamp(timestamp) {
export
function
timestampToUTCDate
(
timestamp
)
{
const
timestampAsNumber
=
stringTSToNumber
(
timestamp
);
const
momentDate
=
moment
(
new
Date
(
timestampAsNumber
)).
format
(
'YYYY/MM/DD'
);
const
UCTDate
=
momentDate
.
split
(
'/'
).
join
(
'
'
);
return
`
${
UCTDate
}
000000
Z`
;
const
UCTTime
=
new
Date
(
timestampAsNumber
).
toISOString
(
);
const
utc
=
moment
(
UCTTime
,
'YYYYMMDDHHmmssZ'
).
format
(
'YYYYMMDDHHmmss
'
);
return
`
${
utc
}
Z`
;
}
export
function
parseBooleanValue
(
boolean
)
{
...
...
@@ -885,32 +885,15 @@ export function isDevMode() {
return
process
.
env
.
NODE_ENV
===
'development'
;
}
export
function
getUTCTime
(
utc
)
{
if
(
!
utc
)
{
return
null
;
}
const
utcString
=
utc
.
slice
(
0
,
utc
.
length
-
1
);
const
year
=
utcString
.
slice
(
0
,
4
);
const
month
=
utcString
.
slice
(
4
,
6
);
const
day
=
utcString
.
slice
(
6
,
8
);
const
hours
=
utcString
.
slice
(
8
,
10
);
const
minutes
=
utcString
.
slice
(
10
,
12
);
const
seconds
=
utcString
.
slice
(
12
,
14
);
return
[
year
,
month
,
day
,
hours
,
minutes
,
seconds
];
}
export
function
getTSFromUTC
(
utc
)
{
let
time
=
utc
;
const
now
=
new
Date
();
if
(
!
time
)
{
return
now
.
getTime
(
);
return
moment
().
format
(
'x'
);
}
if
(
Object
.
prototype
.
toString
.
call
(
utc
)
===
'[object Array]'
)
{
time
=
new
Date
(...
utc
);
}
return
time
.
getTime
(
);
return
moment
(
utc
,
'YYYYMMDDHHmmssZ'
).
format
(
'x'
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment