Add valueOf() method to DateTime and Duration.