sbcgua / ajson

Yet another json parser serializer for ABAP
MIT License
50 stars 15 forks source link

Get/set_date #20

Closed mbtools closed 4 years ago

mbtools commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

The following won't work:

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

sbcgua commented 4 years ago

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

mbtools commented 4 years ago

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.