requestMapper: Fix snapshot date parsing
Regex was wrong, would take "2025-01-01T00:00:00.000Z" even though it's a valid RFC 3339 date.
This commit is contained in:
parent
874f6bdd5c
commit
5cc479115d
1 changed files with 2 additions and 6 deletions
|
|
@ -183,14 +183,10 @@ function commonRequestToState(
|
|||
// 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
|
||||
)
|
||||
) {
|
||||
if (/^\d{4}-\d{2}-\d{2}T\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';
|
||||
snapshot_date = snapshotDateFromRequest + 'T00:00:00Z';
|
||||
} else {
|
||||
snapshot_date = '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue