NSDate+ISO8601.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // NSDate+ISO8601.h
  3. // OCWebDAVClient.h
  4. //
  5. // This class is based in https://github.com/zwaldowski/DZWebDAVClient. Copyright (c) 2012 Zachary Waldowski, Troy Brant, Marcus Rohrmoser, and Sam Soffes.
  6. //
  7. // Copyright (C) 2016, ownCloud GmbH. ( http://www.owncloud.org/ )
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining a copy
  10. // of this software and associated documentation files (the "Software"), to deal
  11. // in the Software without restriction, including without limitation the rights
  12. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. // copies of the Software, and to permit persons to whom the Software is
  14. // furnished to do so, subject to the following conditions:
  15. // The above copyright notice and this permission notice shall be included in
  16. // all copies or substantial portions of the Software.
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. // THE SOFTWARE.
  24. //
  25. #import <Foundation/Foundation.h>
  26. /**
  27. Provides extensions to `NSDate` for representing ISO8601-formatted strings.
  28. */
  29. @interface NSDate (ISO8601)
  30. /**
  31. Returns a new date represented by an ISO8601 string.
  32. @param iso8601String An ISO8601 string
  33. @return Date represented by the ISO8601 string
  34. @bug [Issue #56](https://github.com/samsoffes/sstoolkit/issues/56): Currently this method doesn't work with
  35. strings that include a timezone as anything other than "Z" like this one
  36. "2011-02-01T10:57:55-08:00".
  37. */
  38. + (NSDate *)dateFromISO8601String:(NSString *)iso8601String;
  39. /**
  40. Returns a string representation of the receiver in ISO8601 format.
  41. @return A string representation of the receiver in ISO8601 format.
  42. */
  43. - (NSString *)ISO8601String;
  44. @end