Skip to content

differentiate empty date #79

Closed
Closed

Description

@trancyQ

Hi,
Recently i am using pyodata to retrieve backend data.

Issue is that i still receive a datetime object (2000,01,01) for a date that is empty at the backend. And i saw this is the default date set during initialization.
Is there a way to tell whether the date i received is empty or it's a real date that is 2000 jan 1st.

Thanks.

Activity

  1. jfilak commented on Dec 18, 2019

    @jfilak
    Contributor

    Unfortunately, I cannot see any way how to differentiate between no date and 2000-01-01. Can you post the XML/JSON response from the server, please?

  2. trancyQ commented on Dec 18, 2019

    @trancyQ
    Author

    i am not sure that make sense to do additional post requests since we are already getting data though this pyodata.
    Will it be possible a quick fix to change the default date to a more unrealistic date like 1000-01-01 or 1900-01-01? so that anyone look at it will know it's not an actual date. just suggestion.

  3. trancyQ commented on Dec 18, 2019

    @trancyQ
    Author

    if no change will happen from your side, i am planning to do this.
    if the date do not has a timezone information (.tzinfo) and the date is 2000-01-01, i will consider it as a default setting. Do you think this makes sense?

  4. jfilak commented on Dec 18, 2019

    @jfilak
    Contributor

    I would go for the lowest allowed value which is:

    Edm.DateTime
    Represents date and time with values ranging from 12:00:00 midnight, January 1, 1753 A.D.
    

    https://www.odata.org/documentation/odata-version-2-0/overview/

    I have no idea why we used 2000-01-01 - perhaps, that's how Business gateway handles Null DateTime values.

    I asked for the response from the server to see how the server handles non-set date. If I learn how server handles it, I might be able to use None or something more appropriate.

  5. jfilak commented on Dec 18, 2019

    @jfilak
    Contributor

    I choose the value without thinking I guess and it make sense to change it to something less common.

  6. trancyQ commented on Dec 19, 2019

    @trancyQ
    Author

    Thank you. this will be very helpful.

  7. jfilak commented on Dec 19, 2019

    @jfilak
    Contributor

    Sure, but can you please post your server response? Or at least the part where I can see what the server returns for empty date?

  8. filak-sap commented on Feb 25, 2020

    @filak-sap
    Contributor

    @trancyQ Would it work for you to use None for empty Date. I think it is a rational value.

  9. added a commit that references this issue on Jan 2, 2022
  10. added a commit that references this issue on Jan 12, 2022
  11. rettichschnidi commented on Jan 26, 2022

    @rettichschnidi
    Contributor

    If/When #189 got merged, users of this library will be able to detect missing properties and act on it - including setting a different/custom (default) time.

  12. added a commit that references this issue on Jan 31, 2022
  13. added a commit that references this issue on Jan 31, 2022
  14. rettichschnidi commented on Feb 27, 2022

    @rettichschnidi
    Contributor

    #189 got merged. Proposing to close this issue.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions