Skip to content

[BUG]: _round_datetime('up') adds unnecessary 1 day if input is already midnight #516

Description

@bsr-the-mngrm

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The _round_datetime method always adds 1 day to the input datetime when the direction is "up", even if the input is already exactly at midnight (e.g., 2025-08-07 00:00:00).

This can lead to incorrect rounding behavior and off-by-one-day results in edge cases, especially when using the output to define data quality thresholds or ranges.

Expected Behavior

If the input datetime is already at midnight (00:00:00), the method should return the input as-is instead of adding 1 day.

Steps To Reproduce

  1. Call _round_datetime(datetime(2025, 8, 7, 0, 0, 0), "up")
  2. Observe that it returns 2025-08-08 00:00:00, which is incorrect.
  3. Expected: it should return the same value 2025-08-07 00:00:00

Cloud

Azure

Operating System

Linux

Relevant log output

N/A — logic bug does not produce log output, but can lead to incorrect DQ rule configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions