Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support date shortcuts; see issue #13 #21

Merged
merged 24 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Overpass.jl
gwehrle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function status()::Status

status = Status(
matches[:connection_id],
DateTime(matches[:server_time], "yyyy-mm-ddTHH:MM:SSZ"),
DateTime(matches[:server_time], dateformat"yyyy-mm-ddTHH:MM:SSz"),
matches[:endpoint],
parse(Int, matches[:rate_limit]),
isnothing(matches[:avalible_slots]) ? nothing :
Expand Down Expand Up @@ -217,11 +217,11 @@ See: https://wiki.openstreetmap.org/wiki/Overpass_turbo/Extended_Overpass_Turbo_
function replace_date_shortcuts(query::AbstractString)::AbstractString
if occursin("{{date", query)
# Get the current date and time
current_date = now(tz"UTC")
current_date = now()

# Define the regex pattern for placeholders
pattern = r"\{\{date(?::([0-9]+)\s*(year|month|day|week|hour|minute|second)s?)?\}\}"

# Map string units to Dates.Period constructors
period_map = Dict(
"year" => Year,
Expand Down
Loading