Wizard: Parse old snapshot dates when editing
This updates format of the snapshot date when the blueprint with the old format gets edited.
This commit is contained in:
parent
44685f4c76
commit
563ff04054
1 changed files with 19 additions and 1 deletions
|
|
@ -173,9 +173,27 @@ function commonRequestToState(
|
|||
(image) => image.image_type === 'azure'
|
||||
);
|
||||
|
||||
const snapshot_date =
|
||||
const snapshotDateFromRequest =
|
||||
request.image_requests.find((image) => !!image.snapshot_date)
|
||||
?.snapshot_date || '';
|
||||
let snapshot_date = '';
|
||||
|
||||
// Previously DateOnly format of the snapshot date was used (YYYY-MM-DD),
|
||||
// meaning this is a format that can be present in already existing blueprints.
|
||||
// Currently used format is RFC3339 (YYYY-MM-DDTHH:MM:SSZ), this condition
|
||||
// checks which format is getting parsed and converts DateOnly to RFC3339
|
||||
// when necessary.
|
||||
if (
|
||||
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{2}:\d{2}$/.test(
|
||||
snapshotDateFromRequest
|
||||
)
|
||||
) {
|
||||
snapshot_date = snapshotDateFromRequest;
|
||||
} else if (/^\d{4}-\d{2}-\d{2}$/.test(snapshotDateFromRequest)) {
|
||||
snapshot_date = snapshotDateFromRequest + 'T00:00:00+00:00';
|
||||
} else {
|
||||
snapshot_date = '';
|
||||
}
|
||||
|
||||
const awsUploadOptions = aws?.upload_request
|
||||
.options as AwsUploadRequestOptions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue