You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Align NowFunc::new() with canonical ConfigOptions timezone and enhance documentation (#18347)
## Which issue does this PR close?
* Closes#18219.
---
## Rationale for this change
The deprecated `NowFunc::new()` constructor previously initialized its
timezone using the shorthand offset `"+00"`, which was inconsistent with
the canonical UTC offset format `"+00:00"` used by
`ConfigOptions::default()`. This mismatch could cause subtle
inconsistencies in `ScalarValue` comparisons or downstream timezone
handling.
This PR ensures backward compatibility while aligning `NowFunc::new()`
with the canonical default configuration, making behavior consistent
across both constructors. It also improves documentation to clarify this
relationship and provides a regression test to confirm parity between
the two initialization paths.
---
## What changes are included in this PR?
* Updated the deprecated `NowFunc::new()` to delegate to
`NowFunc::new_with_config(&ConfigOptions::default())`.
* Added detailed doc comments explaining the rationale and proper usage
of the constructors.
* Introduced a new test module verifying that `NowFunc::new()` and
`NowFunc::new_with_config()` produce identical return fields and scalar
values.
* Updated user documentation (`scalar_functions.md`) to note the
constructor preference and clarify the canonical default timezone format
(`+00:00`).
---
## Are these changes tested?
✅ Yes. A new test `now_func_default_matches_config` was added to confirm
functional equivalence between the legacy and configuration-based
constructors, including matching field outputs and scalar timezones.
---
## Are there any user-facing changes?
* **Yes**, but backward-compatible:
* `NowFunc::new()` remains available but now mirrors the canonical
timezone offset (`+00:00`).
* Documentation has been updated to guide users toward the preferred
`NowFunc::new_with_config()` method.
No breaking API or behavior changes are expected, as this update
standardizes the default timezone while maintaining prior function
signatures.
0 commit comments