Hi
Am 30.09.21 um 23:03 schrieb Sven Schreiber:
Am 30.09.2021 um 19:40 schrieb Artur T.:
> Am 30.09.21 um 18:27 schrieb Artur T.:
>> Am 30.09.21 um 17:38 schrieb Sven Schreiber:
>>> Am 30.09.2021 um 17:29 schrieb Artur T.:
>> I am just working on a proposal supporting both quarterly and monthly
> <>
> function scalar gdate_to_iso8601 (string date "Date string",
> string frequency "Frequency of
> observation")
Maybe there's a case for using an integer arg similar to $pd here,
allowing values 4 and 12.
Ah, good point. I've changed the signature to
<>
function scalar gdate_to_iso8601 (string date "Date string",
string frequency[null] "Frequency of
observation")
</>
Thus, the "frequency" string parameter is optional. If not passed, the
frequency string is determined by the underlying periodicity as retrived
by the $pd accessor.
The behavior can be seen here in the test script:
https://github.com/atecon/calendar_utils/blob/feature/prepare-v03/tests/r...
> /* This function only supports quarterly date strings as
used and
This old comment of mine should be updated I guess, if you aim to cover
monthly as well.
Fixed.
> Here you find the tests which explain what that function does and
is
> expected to return:
>
https://github.com/atecon/calendar_utils/blob/feature/prepare-v03/tests/r...
>
>
> The supported frequencies are quarterly and monthly data.
>
> Is this what you had in mind?
In principle, yes I guess so. Thanks, Artur! Some further comments about
that stuff on github:
- is_valid_gdate_format: seems correct in context, but the name is a bit
misleading, since it doesn't allow the "." part.
True. I've changed it to is_valid_date_delimiter(). It's only a private
function anyway but proper naming is useful.
- get_iso_date: What does "return: type, description" mean?
It just
returns a number.
The doc string was not written, then. This is fixed now.
- get_iso_date: The comment "# first month in quarter" is
copied-n-pasted once too often, doesn't belong to the "monthly" case.
Thanks, that's fixed.
The latest source code is here:
https://github.com/atecon/calendar_utils/blob/feature/prepare-v03/src/cal...
Ok, we all agree, I can finish this new version by updating the help text.
Best,
Artur