Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Date with BC note in PostgreSQL parsed incorrectly #500

@SamyRai

Description

@SamyRai

Hello,

I am using:

hanami (1.2.0)
hanami-model (1.2.0)

and PostgreSQL 10.5 with table authors in it. This table has a column date_of_birth (Date type).
I have an entity Author with schema containing date_of_birth attribute and type Types::Date.

For one author this column contains following

=# select date_of_birth from authors where id='0a33078c-c440-4279-9cc7-172b8684b87a'
 date_of_birth 
---------------
 0530-01-01 BC
(1 row)

If i try to parse this string manually via

 Date.parse('0530-01-01 BC').year => -529

I get correct date with minus.

But if I do this

@author_repo.find(params[:author_id]).date_of_birth.year => 530

it ignores BC part.

Could you tell me if I am doing something wrong or if it an issue. If last, maybe you could give me a hint where I can take a look to help you to solve this issue.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions