Skip to content
This repository was archived by the owner on Jun 19, 2026. It is now read-only.
This repository was archived by the owner on Jun 19, 2026. It is now read-only.

Allow DateStyle to be "ISO, MDY", "ISO, DMY", or "ISO, YMD". #30

Closed

Description

@AMBIENTE1

Hallo, I would like to change parameter datestyle from ISO, MDY to ISO, DMY in Parameter.swift
When I try:
let text = "SET DateStyle TO 'ISO, DMY';"
let cursor = try Database.connection().prepareStatement(text: text).execute()

error: Invalid value for Postgres parameter (response.name): ISO, DMY (must be ISO, MDY); closing connection

Please what is the best way to do this?

Activity

  1. pitfield commented on Nov 2, 2020

    @pitfield
    Member

    PostgresClientKit sets the Postgres DATESTYLE parameter to ISO, MDY and doesn't allow this value to be changed. This prevents misinterpretation of dates sent over the wire due to configuration mismatches.

    If you want to control the format of dates in your user interface, you should use the PostgresDate type (or PostgresTimestampWithTimeZone for date/time values) and a DateFormatter (from the Foundation framework).

  2. AMBIENTE1 commented on Nov 9, 2020

    @AMBIENTE1
    Author

    In my Postgres database are many funcs, where the date is set as string in format DD.MM.YYYY. ISO DMY is required. Would it be possible to set ISO DMY or MDY as a parameter please?

  3. pitfield commented on Nov 11, 2020

    @pitfield
    Member

    Could please try this commit (tip of the develop branch)? 40fe0ff

    This should allow you to set the DATESTYLE paraameter to ISO, MDY, ISO, DMY, or ISO, YMD.

  4. AMBIENTE1 commented on Nov 12, 2020

    @AMBIENTE1
    Author

    If i used playground, i couldn't use import PostgresClientKit :No such module 'PostgresClientKit'

    But i modified the test and it worked properly.
    Can you please add this modification to the release?

  5. changed the title [-]change parameter[/-] [+]Allow DateStyle to be "ISO, MDY", "ISO, DMY", or "ISO, YMD".[/+] on Nov 13, 2020
  6. pitfield commented on Nov 13, 2020

    @pitfield
    Member

    Released in v1.3.1.

  7. AMBIENTE1 commented on Nov 21, 2020

    @AMBIENTE1
    Author

    thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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