How to handle AMAZON.Date in .NET
Hey Stefan, thanks for writing this library - it works great! Do you have any utility or library code in FreeBusy that handles parsing the ISO8601 date values coming in from the AVS when a slot is defined as of type AMAZON.Date? In some cases, the incoming string isn't parse-able to a DateTime or DateTimeOffset (for example, if I say "this weekend" the slot value comes in a "2016-W29-WE" which doesn't work with DateTime.TryParse(). Reading the docs on AMAZON.Date I see several formats that likely won't parse. Just wondering if there was a good mechanism for handling this in .NET, or if you just ended up parsing the incoming value for some known regex patterns. Thanks again for putting the time into creating this library!
Hi, thanks for the kind words. The AMAZON.Date format is based on Java Duration which is a subset of ISO 8601 standard. See http://docs.oracle.com/javase/8/docs/api/java/time/Duration.html and http://en.wikipedia.org/wiki/ISO_8601#Durations for context.
In a future release I'll contribute our parsing code to the library. It doesn't cover 100% of the standard, but we do handle the most frequent patterns.
Hello,
Yesterday I submitted a pull request with code that parses the amazon date format. It handles all of the cases covered in the Amazon docs (except seasons) and few that show up but aren't mentioned in the docs.
I wrote this for my app. The AmazonSkillKit was such a time saver for me, I figured I'd contribute.
Chris
Thanks for the contribution @ChrisInSeattle! I'll review and merge soon.
You can also handle AMAZON.Date in SQL. If you are pulling from SQL Server, it looks like the attached example.