This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am pronvis on github. | |
* I am pronvis (https://keybase.io/pronvis) on keybase. | |
* I have a public key ASCrpjS9pWKFBl4_i3zSUOditYt4n_eh9bVxxiY6SIZqYgo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.joda.time.DateTime | |
object DateUtils { | |
def applyModifier(dt: DateTime, strWithModifiers: String): DateTime = { | |
val modifiers = parseString(strWithModifiers) | |
val withPlusesDt = modifiers.plusModifiers.foldLeft(dt) { case(newDt, dateModifier) => dateModifier.`type` match { | |
case "second" => newDt.plusSeconds(dateModifier.count) | |
case "seconds" => newDt.plusSeconds(dateModifier.count) |