A PHP script / API endpoint that will generate the Roman Catholic liturgical calendar for any given year, calculating the mobile festivities and the precedence of solemnities, feasts, memorials...
Apache License 2.0
39
stars
10
forks
source link
how should dates be represented in the Open API description? #7
Reading some of the discussions on this stackoverflow post, it seems that according to the Open API specification, DATE-TIME types are expected to be represented according to RFC3339.
Reading up on RFC3339, I see that DATE-TIME should be represented as YYYY-MM-DDTHH:MM:SSZ where T delimits the date string from the time string and Z indicates UTC time.
The same ref spec also says that for readability, a space ` can be used instead of aTbetween date and time, which is what we are currently using in our representation in the case of theMetadataproperty with theFEASTS_MEMORIALSand theSOLEMNITIESarrays. DateTime objects in PHP are serialized by PHP'sjson_encodefunction. If we need them in a slightly different format, we would need to create our ownDateTimeclass extending PHP's DateTime class, and implement a customizedJsonSerializable`, example here.
Created LitCalDateTime to implement this at least in the initial Solemnities array. As for the UNIX timestamps, I think I'll just stick with them for now...
Reading some of the discussions on this stackoverflow post, it seems that according to the Open API specification, DATE-TIME types are expected to be represented according to RFC3339.
Reading up on RFC3339, I see that DATE-TIME should be represented as
YYYY-MM-DDTHH:MM:SSZ
whereT
delimits the date string from the time string andZ
indicates UTC time. The same ref spec also says that for readability, a space` can be used instead of a
Tbetween date and time, which is what we are currently using in our representation in the case of the
Metadataproperty with the
FEASTS_MEMORIALSand the
SOLEMNITIESarrays. DateTime objects in PHP are serialized by PHP's
json_encodefunction. If we need them in a slightly different format, we would need to create our own
DateTimeclass extending PHP's DateTime class, and implement a customized
JsonSerializable`, example here.