Skip to content

Add roboflow_core/current_time@v1 Workflow block#2410

Merged
PawelPeczek-Roboflow merged 7 commits into
mainfrom
pn/current-time-block
Jun 4, 2026
Merged

Add roboflow_core/current_time@v1 Workflow block#2410
PawelPeczek-Roboflow merged 7 commits into
mainfrom
pn/current-time-block

Conversation

@patricknihranz
Copy link
Copy Markdown
Contributor

Summary

Adds a new Workflow block roboflow_core/current_time@v1 (category: formatter) that outputs the current date and time for a user-selected timezone.

  • Input: timezone — a curated IANA timezone name (literal Literal[...] or a Selector(STRING_KIND)), default "UTC". The curated set (~55 zones) covers the common UTC offsets and exposes friendly labels (e.g. UTC-5/-4 Eastern Time (EST/EDT)) via values_metadata so the app renders a clean dropdown.
  • Outputs:
    • timestamp — timezone-aware datetime (TIMESTAMP_KIND), composable by downstream blocks
    • iso_string, date (%Y-%m-%d), time (%H:%M:%S) — STRING_KIND conveniences
  • Validates the timezone at runtime and raises a clear ValueError for unsupported/unknown values.

Implementation notes

  • Uses stdlib zoneinfo, falling back to backports.zoneinfo on Python < 3.9.
  • Adds tzdata to requirements so the IANA database is present on slim/Windows runtimes that lack system tz data.
  • Registered in core_steps/loader.py (import + load_blocks() entry).

Testing

  • Unit tests (tests/workflows/unit_tests/.../test_current_time.py): manifest parsing (valid/default/selector/invalid), curated-enum + values_metadata schema exposure, DST-vs-fixed-offset behavior, run() output shape/consistency, and error paths. 11 passed locally.
  • Integration test (tests/workflows/integration_tests/.../test_workflow_with_current_time.py): runs the block end-to-end through ExecutionEngine and asserts a timezone-aware result with consistent derived strings.

Type

Bug fix / new feature: non-breaking, additive new block. No changes to existing blocks.

patricknihranz and others added 3 commits April 14, 2026 21:44
The (Number) in range operator was already implemented in the evaluation
engine and BinaryStatement union but was not included in the introspection
export, making it invisible to the workflow builder UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds the NumberInRange BinaryOperator class and its evaluation lambda so
the operator exposed in the workflow builder UI has a working backend.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New formatter block that outputs the current date/time for a user-selected
timezone. Inputs a curated IANA timezone (literal or selector, default UTC) and
returns a timezone-aware timestamp plus iso_string, date, and time strings.

Uses stdlib zoneinfo (backports.zoneinfo for py<3.9) and adds tzdata so the
timezone database is available on slim/Windows runtimes. Curated dropdown options
expose friendly UTC-offset labels via values_metadata. Registered in loader.py.
Includes unit tests and a full execution-engine integration test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread requirements/_requirements.txt Outdated
fastapi>=0.133.0,<0.140 # 0.133+ dropped the starlette<1.0 cap; be careful with upper pin - fastapi might remove support for on_event
starlette>=1.0.1 # CVE-2026-48710 (BadHost) — Host-header path-injection fix
python-dotenv~=1.0.0
backports.zoneinfo>=0.2.1; python_version < "3.9"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not support Py < 3.9

Copy link
Copy Markdown
Collaborator

@PawelPeczek-Roboflow PawelPeczek-Roboflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from dependency which is not needed

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Jun 4, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​python-dotenv@​1.0.19999100100100
Updatedpypi/​fastapi@​0.136.3 ⏵ 0.115.14100100100100100

View full report

@patricknihranz patricknihranz enabled auto-merge (squash) June 4, 2026 17:58
@PawelPeczek-Roboflow PawelPeczek-Roboflow merged commit 1e3d5a9 into main Jun 4, 2026
48 checks passed
@PawelPeczek-Roboflow PawelPeczek-Roboflow deleted the pn/current-time-block branch June 4, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants