From cb57713c072c0af86d826d5c015c0f23f5eeb538 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Tue, 3 Mar 2015 17:27:33 -0800 Subject: [PATCH] [ReactNative] modernize DatePicker --- ReactKit/Base/RCTConvert.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ReactKit/Base/RCTConvert.m b/ReactKit/Base/RCTConvert.m index ab79cd861..4f3e8b05c 100644 --- a/ReactKit/Base/RCTConvert.m +++ b/ReactKit/Base/RCTConvert.m @@ -131,9 +131,12 @@ RCT_CONVERTER_CUSTOM(NSUInteger, NSUInteger, [json unsignedIntegerValue]) return [NSURLRequest requestWithURL:[self NSURL:json]]; } -RCT_CONVERTER_CUSTOM(NSDate *, NSDate, [NSDate dateWithTimeIntervalSince1970:[json doubleValue]]) -RCT_CONVERTER_CUSTOM(NSTimeZone *, NSTimeZone, [NSTimeZone timeZoneForSecondsFromGMT:[json doubleValue]]) -RCT_CONVERTER(NSTimeInterval, NSTimeInterval, doubleValue) +// JS Standard for time is milliseconds +RCT_CONVERTER_CUSTOM(NSDate *, NSDate, [NSDate dateWithTimeIntervalSince1970:[json doubleValue] / 1000.0]) +RCT_CONVERTER_CUSTOM(NSTimeInterval, NSTimeInterval, [json doubleValue] / 1000.0) + +// JS standard for time zones is minutes. +RCT_CONVERTER_CUSTOM(NSTimeZone *, NSTimeZone, [NSTimeZone timeZoneForSecondsFromGMT:[json doubleValue] * 60.0]) /** * NOTE: We don't deliberately don't support NSTextAlignmentJustified in the