Giter Site home page Giter Site logo

samkrishna / iso8601dateformattervaluetransformer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blakewatters/iso8601dateformattervaluetransformer

0.0 3.0 0.0 150 KB

A small Objective-C library that integrates Peter Hosey's ISO8601DateFormatter with RKValueTransformers

License: Apache License 2.0

Objective-C 74.53% Ruby 25.47%

iso8601dateformattervaluetransformer's Introduction

ISO8601DateFormatterValueTransformer

A small Objective-C library that integrates Peter Hosey's ISO8601DateFormatter with RKValueTransformers.

The implementation is done by adding RKValueTransforming conformance to the ISO8601DateFormatter via a category.

Examples

Usage

Basic usage is identical to all other RKValueTransforming classes.

#import "ISO8601DateValueTransformer.h"

RKISO8601DateFormatter *dateFormatter = [RKISO8601DateFormatter defaultISO8601DateFormatter];

// Transforming NSDate -> String
NSString *dateString = nil;
NSError *error = nil;
BOOL success = [dateFormatter transformValue:[NSDate date] toValue:&dateString ofClass:[NSDate class] error:&error];

// Transforming NSString -> NSDate
NSDate *date = nil;
success = [dateFormatter transformValue:@"2013-09-12T07:24:56-04:00" toValue:&dateString ofClass:[NSDate class] error:&error];

Configuration as Default Date Transformer

Adding the date formatter to the default value transformer at position 0 ensures that it is used ahead of all other NSString <-> NSDate value transformers.

#import "ISO8601DateValueTransformer.h"

RKISO8601DateFormatter *dateFormatter = [RKISO8601DateFormatter defaultISO8601DateFormatter];
[[RKValueTransformer defaultValueTransformer] insertValueTransformer:dateFormatter atIndex:0];

Credits

Blake Watters

License

ISO8601DateFormatterValueTransformer is available under the Apache 2 License. See the LICENSE file for more info.

iso8601dateformattervaluetransformer's People

Contributors

blakewatters avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.