mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Removes the 'Z' from the UNTIL before sending the rrule to the API
This commit is contained in:
@@ -1,5 +1,21 @@
|
|||||||
export default
|
export default
|
||||||
function RRuleToAPI() {
|
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) {
|
return function(rrule, scope) {
|
||||||
let localTime = scope.schedulerLocalTime;
|
let localTime = scope.schedulerLocalTime;
|
||||||
let timeZone = scope.schedulerTimeZone.name;
|
let timeZone = scope.schedulerTimeZone.name;
|
||||||
@@ -7,6 +23,8 @@ export default
|
|||||||
let response = rrule.replace(/(^.*(?=DTSTART))(DTSTART.*?)(=.*?;)(.*$)/, (str, p1, p2, p3, p4) => {
|
let response = rrule.replace(/(^.*(?=DTSTART))(DTSTART.*?)(=.*?;)(.*$)/, (str, p1, p2, p3, p4) => {
|
||||||
return p2 + ';TZID=' + timeZone + ':' + localTime + ' ' + 'RRULE:' + p4;
|
return p2 + ';TZID=' + timeZone + ':' + localTime + ' ' + 'RRULE:' + p4;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
response = parseOutZ(response);
|
||||||
return response;
|
return response;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user