mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 22:18:01 -03:30
Removes the 'Z' from the UNTIL before sending the rrule to the API
This commit is contained in:
parent
33d4c97156
commit
876431c529
@ -1,5 +1,21 @@
|
||||
export default
|
||||
function RRuleToAPI() {
|
||||
|
||||
// This function removes the 'Z' from the UNTIL portion of the
|
||||
// rrule. The API will default to using the timezone that is
|
||||
// specified in the TZID as the locale for the UNTIL.
|
||||
function parseOutZ (rrule) {
|
||||
let until = rrule.split('UNTIL=');
|
||||
if(_.has(until, '1')){
|
||||
rrule = until[0];
|
||||
until = until[1].replace('Z', '');
|
||||
return `${rrule}UNTIL=${until}`;
|
||||
} else {
|
||||
return rrule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return function(rrule, scope) {
|
||||
let localTime = scope.schedulerLocalTime;
|
||||
let timeZone = scope.schedulerTimeZone.name;
|
||||
@ -7,6 +23,8 @@ export default
|
||||
let response = rrule.replace(/(^.*(?=DTSTART))(DTSTART.*?)(=.*?;)(.*$)/, (str, p1, p2, p3, p4) => {
|
||||
return p2 + ';TZID=' + timeZone + ':' + localTime + ' ' + 'RRULE:' + p4;
|
||||
});
|
||||
|
||||
response = parseOutZ(response);
|
||||
return response;
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user