Search code examples
grailsjodatimelocaltime

Update Joda-Time in Grails


I use Joda-Time via joda-time plugin in Grails to input time data, but its constructor shows time, which is one hour ahead then in my time zone. Compulsory timezone setting in constructor as like:

new LocalTime(DateTimeZone.forID("Europe/Moscow"))

doesn't help.

I've heard, what it happens, because I've outdated timezone data containing old dst rules. And I must to update it to newest version v2.8, which would probably help against old data. How to do it if I use newest joda-time plugin in Grails, which was updated last July.


Solution

  • In BuildConfig.groovy, try

    dependencies {
        compile "joda-time:joda-time:x.y"  // x.y is the version of interest, make sure it's compatible with the plugin
    }
    plugins {
        compile ":joda-time:1.5" {
            excludes "joda-time" 
        }
    }
    

    Ref: http://grails.github.io/grails-doc/2.4.x/guide/single.html#pluginDependencies