All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.runtime.converters.CalendarConverter Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
package cucumber.runtime.converters;

import java.text.Format;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class CalendarConverter extends TimeConverter {
    public CalendarConverter(Locale locale) {
        super(locale, new Class[]{Calendar.class});
    }

    @Override
    protected Object transform(Format format, String argument) {
        Date date = (Date) super.transform(format, argument);
        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"), locale);
        cal.setTime(date);
        return cal;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy