Skip to content

Commit

Permalink
fix date handling on input data for new Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
mindcrime committed Jul 12, 2017
1 parent 31cd092 commit 1ee052e
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -3,6 +3,8 @@ package org.fogbeam.neddick.jaxrs
import static org.grails.jaxrs.response.Responses.*
import groovy.json.JsonSlurper

import java.text.SimpleDateFormat

import javax.ws.rs.Consumes
import javax.ws.rs.GET
import javax.ws.rs.POST
Expand All @@ -21,6 +23,8 @@ class ChannelResource
{
def channelService;
def userService;
// 2017-07-12T00:06:54.833Z
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:MM:ss.SSS'Z'" );


@GET
Expand Down Expand Up @@ -64,7 +68,12 @@ class ChannelResource
newChannel.uuid = jsonObject.uuid;
newChannel.name = jsonObject.name;
newChannel.description = jsonObject.description;
newChannel.dateCreated = Date.parse(jsonObject.dateCreated);

String dateCreated = jsonObject.dateCreated;
log.info( "dateCreated: ${dateCreated}");

newChannel.dateCreated = sdf.parse( dateCreated );

newChannel.privateChannel = Boolean.parseBoolean(jsonObject.privateChannel);
newChannel.owner = userService.findUserByUserId( jsonObject.userId);

Expand Down

0 comments on commit 1ee052e

Please sign in to comment.