diff --git a/scripts/collection_from_items.py b/scripts/collection_from_items.py index 40e7c762..6b092e1e 100644 --- a/scripts/collection_from_items.py +++ b/scripts/collection_from_items.py @@ -2,6 +2,7 @@ import json import os from argparse import Namespace +from datetime import datetime, timezone from typing import TYPE_CHECKING, List import shapely.geometry @@ -10,7 +11,7 @@ from linz_logger import get_log from scripts.cli.cli_helper import coalesce_multi_single, str_to_gsd -from scripts.datetimes import parse_rfc_3339_datetime +from scripts.datetimes import RFC_3339_DATETIME_FORMAT, parse_rfc_3339_datetime from scripts.files.files_helper import SUFFIX_FOOTPRINT, SUFFIX_JSON from scripts.files.fs_s3 import bucket_name_from_path, get_object_parallel_multithreading, list_files_in_uri from scripts.logging.time_helper import time_in_ms @@ -114,10 +115,11 @@ def parse_args(args: List[str] | None) -> Namespace: "--current-datetime", dest="current_datetime", help=( - "The datetime that is used as current datetime in the metadata. " + "The datetime to be used as current datetime in the metadata. " "Format: RFC 3339 UTC datetime, `YYYY-MM-DDThh:mm:ssZ`." ), - required=True, + required=False, + default=datetime.now(timezone.utc).strftime(RFC_3339_DATETIME_FORMAT), ) return parser.parse_args(args) diff --git a/scripts/tests/collection_from_items_test.py b/scripts/tests/collection_from_items_test.py index 7e9a86ce..6e8ad48e 100644 --- a/scripts/tests/collection_from_items_test.py +++ b/scripts/tests/collection_from_items_test.py @@ -70,8 +70,6 @@ def test_should_create_collection_file(item: ImageryItem, fake_linz_slug: str) - "Placeholder", "--concurrency", "25", - "--current-datetime", - any_epoch_datetime_string(), "--linz-slug", fake_linz_slug, ]