I am looking for a well supported (i.e. in active development or so mature that it can be a natural and uncontraversial choice) calendar library. I primarily need it to tell me when the next one or more dates are that match criteria I specify. The representative criteria I need to supply are:

Every 1-12 month(s) on the

  1. last Saturday
  2. last day
  3. first Saturday
  4. on # day

(Of course, if the library can handle these, it can likely handle a lot more that I may find useful at a later date.)

I will be using this library on OS X, so the preferred language of the library will be (in order of desirability) (a) Swift, (b) Objective-C, (c) C & (d) C++.

Apple's Cocoa classes supply two potential solutions:

  1. The EventKit classes. The provided API can handle everything I mentioned above. The problem with it is that it requires that I interact directly with the user's calendar and this is something I want to avoid.

  2. The NSCalendar & NSDateComponents classes. These can handle most of what I mentioned above, but I do not see a way to specify 'last', for example.

Does anyone have any suggestions?


One suggestion for you would be the wxWidgets library's wxDateTime class.

wxWidgets is written in C++ is both mature, (since 1992), and actively developed, is well documented and is cross platform. It is free, both Gratis & Open Source, but is usable on commercial projects.

Taking your examples in order:

  1. Every month on the last Saturday wxDateTime::SetToLastWeekDay
  2. Every month on the last day wxDateTime::SetToLastMonthDay
  3. Every month on the first day just set to first of the month
  4. Every month on day # just set to day # in the month
  5. Every month on the first Saturday wxDateTime::SetToWeekDay
  6. Every # months on the first Saturday wxDateTime::SetToWeekDay in a loop
  7. Every # months on day # just set to day # in the month in a loop
  8. Every # months on the last Saturday wxDateTime::SetToLastWeekDay in a loop

You do not have to use the whole of the wxWidgets library, (which gives you a full GUI development library), you can just use parts of it by not building it as a monolithic library.

Additional calendar type members in wxDateTime:

  • Date/Time parsing and formatting
  • Date/Time comparisons & calculations
  • Time zone calculations
  • Gregorian/Julian calendar calculations
  • Also includes the majority of holidays for IsWorkDay in selected countries.
  • Not epoch bounded - you can perform calculations on dates prior to 1970 the range of supported dates goes from about 4714 B.C. to some 480 million years in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.