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

Initializing a DateTimeType without an argument should set it to now #280

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented Jun 19, 2024

For some reason, nil.respond_to?(:to_d) equals true, which resulted in DateTimeTime.new => epoch instead of now.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
@jimtng jimtng added the bug Something isn't working label Jun 19, 2024
@jimtng jimtng requested a review from ccutrer June 19, 2024 02:27
Copy link
Contributor

@ccutrer ccutrer left a comment

Choose a reason for hiding this comment

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

I mean, it's very much on purpose.

nil.to_i # => 0
nil.to_s # => ""
nil.to_a # => []
nil.to_h # => {}

so it follows that nil.to_d # => 0.0

@ccutrer ccutrer merged commit 9352a2d into openhab:main Jun 26, 2024
18 checks passed
@jimtng jimtng deleted the datetimetype-argless-init branch July 11, 2024 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants