NSDate+ZZExTest.m 877 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // NSDate+ZZExTest.m
  3. // ZZFoundation_Tests
  4. //
  5. // Created by Max on 2020/12/29.
  6. // Copyright © 2020 bymiracles@163.com. All rights reserved.
  7. //
  8. #import "Kiwi.h"
  9. #import <ZZFoundation.h>
  10. SPEC_BEGIN(DateEx)
  11. NSDate * today = [NSDate date];
  12. NSDate * timeZoneCurrent = [[NSDate date] addTimeZone];
  13. describe(@"week", ^{
  14. it(@"today should ", ^{
  15. [[theValue([today weekOfMonth]) should] equal:theValue(5)];
  16. });
  17. it(@"time should be correct", ^{
  18. NSDateFormatter *format = [[NSDateFormatter alloc] init];
  19. [format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  20. NSString * str = [today stringWithDateStyle:NSDateFormatterFullStyle timeStyle:NSDateFormatterFullStyle];
  21. NSString * str1 = [format stringFromDate:timeZoneCurrent];
  22. NSLog(@"time now is:%@",str);
  23. NSLog(@"timeZoneCurrent now is:%@",str1);
  24. });
  25. });
  26. SPEC_END