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

Get/set_date #20

Closed
mbtools opened this issue Sep 5, 2020 · 4 comments
Closed

Get/set_date #20

mbtools opened this issue Sep 5, 2020 · 4 comments

Comments

@mbtools
Copy link
Contributor

mbtools commented Sep 5, 2020

Set_date stores YYYY-MM-DD, but get_date requires '^(\d{4})-(\d{2})-(\d{2})(T|$)' with T or $ at the end (same regex in to_abap).

So you can't get a date that was set before. Maybe set_date should store YYYY-MM-DDT00:00:00Z

@sbcgua
Copy link
Owner

sbcgua commented Sep 6, 2020

yeah, mmm. YMD only is quite typical for json. I'd better add set_date_time ... but why "you can't get a date that was set before" ? Do you mean get_date + set_date changes the value ?

@mbtools
Copy link
Contributor Author

mbtools commented Sep 8, 2020

The following won't work:

  • Program 1 produces a json file using set_date.
  • Program 2 (for example on another server) tries to read the json file using get_date or to_abap (with a target date field).

In general, I would say the get/set methods should be symmetric. get_date_time, set_date_time would work

@sbcgua
Copy link
Owner

sbcgua commented Sep 9, 2020

But why do you say it is non symmetric ? set_date produces YYYY-MM-DD which is then compatible with get_date

@mbtools
Copy link
Contributor Author

mbtools commented Sep 9, 2020

you are correct. i had "expires": "2020-06-30 23:59:59" in a response where get_date didn't work. i removed the (T|$) from my version and all is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants