Skip to content
GWT client side datehandling utility example with unit rests
Java
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
build
src
LICENSE
README
pom.xml

README

INTRODUCTION

This project is meant to demonstrate a client-side date handling utility for use with GWT.

As of 2012-11-07, this project is now 100% functional.  The reason being... it properly handles "transition days", those days that fall within time zones that respect Daylight Savings.



BACKGROUND

Reading I've done on the subject

	* http://stackoverflow.com/questions/11989219/sending-a-date-and-timezone-from-gae-server-to-gwt-client
	* http://stackoverflow.com/questions/5105004/how-to-parse-date-string-using-timezone-in-gwt?rq=1
	* http://stackoverflow.com/questions/10041811/how-can-i-shift-timezone-of-date-object-created-in-local-timezone-to-target-time?rq=1
	* http://stackoverflow.com/questions/2189148/how-do-i-get-gwt-datetimeformat-to-display-using-the-server-timezone-rather-tha?rq=1
	
And the question I asked 

	* http://stackoverflow.com/questions/13214624/gwt-date-handing-have-client-respect-servers-timezone
	
	

PURPOSE

I had required some help from the community to improve the current implementation so that it allowed for working with dates (days, hours, minute interval labels tied to an ISO-8601 String formatted instant) 
in whichever time zone the client accesses this application.

The constraint is that each ISO-8601 String instant will be fed to the client with a pre-defined timezone offset.  E.g., Imagine a case where "market time" is accepted as US Central Time (i.e., GMT-05:00 while Daylight Savings is in effect or GMT-06:00 while Standard Time is in effect). And anywhere the client accesses the application all instants are to be displayed in this "market time."  The utility class, CSTimeUtil.java, is documented.  It's corresponding GWTTestCase is CSTimeUtilTestGwt.java.

If you're curious, please download the source.

Thanks in advance for your time and consideration!



SOFTWARE REQUIREMENTS

JDK 1.7
Maven 3.0.4



SETUP

Add the following instruction within <pluginGroups></pluginGroups> of your user home parent .m2/settings.xml file

    <pluginGroup>org.mortbay.jetty</pluginGroup>



BUILD

    mvn -Pdefault -Plocal clean install



DEBUGGING/TROUBLESHOOTING
    
To debug this app in GWT development mode

    mvn gwt:debug
    

For more detail on other gwt-maven-plugin options, run
    
    mvn help:describe -DgroupId=org.codehaus.mojo -DartifactId=gwt-maven-plugin -Ddetails 
    


DEPLOYING/RUNNING
        
To run this webapp, on

    JETTY 8  (LOCALHOST)
    
    mvn clean install -Pdefault -Plocal jetty:run-war           		
    press Ctrl+C                         								
    
    visit http://localhost:8080    
    (if -Djetty.port=9090 set in MAVEN_OPTS, then change port to 9090)
    

    TOMCAT 6 (LOCALHOST)

    mvn clean install -Pdefault -Plocal -Ptomcat6x-local cargo:start    
    press Ctrl+C                         								
    
    visit http://localhost:8081/gwt-datehandling-example
    logs to be found in /target/tomcat6x directory
    
    
    TOMCAT 7 (LOCALHOST)

    mvn clean install -Pdefault -Plocal -Ptomcat7x-local cargo:start    
    press Ctrl+C                         								
    
    visit http://localhost:8081/gwt-datehandling-example
    logs to be found in /target/tomcat7x directory
    
    
    JBOSS 5.1.2 (LOCALHOST)

    mvn clean install -Pdefault -Plocal -Pjboss51x-local cargo:start 
    	-Djboss51x.home=/path/to/jboss     
		
		(e.g., on Windows,  
			mvn clean install -Pdefault -Plocal -Pjboss51x-local cargo:start 
			-Djboss51x.home="D:\development\servers\jboss-5.1.0.GA")
    press Ctrl+C                                                     									
         
    visit http://localhost:8081/gwt-datehandling-example
    logs to be found in /target/jboss51x directory


	JBOSS 7.1.x or 6 EAP (LOCALHOST)

    mvn clean install -Pdefault -Plocal -Pjboss71x-local cargo:start 
    	-Djboss71x.home=/path/to/jboss      (to start the container)
    		
    	(e.g., on Windows,  
    		mvn clean install -Pdefault -Plocal -Pjboss71x-local cargo:start 
    		-Djboss71x.home="D:\development\servers\jboss-as-7.1.1.Final")
    press Ctrl+C                                                     									 
        
    /path/to/jboss is the directory where you've installed JBOSS 7.1.x on your workstation/laptop
         
    visit http://localhost:8081/gwt-datehandling-example
    logs to be found in /target/jboss71x directory
    
Something went wrong with that request. Please try again.