use of org.joda.time.LocalTime in project drill by axbaretto.
the class TestDateFunctions method testToChar.
@Test
public void testToChar() throws Exception {
mockUsDateFormatSymbols();
String[] expectedResults = { (new LocalDate(2008, 2, 23)).toString("yyyy-MMM-dd"), (new LocalTime(12, 20, 30)).toString("HH mm ss"), (new LocalDateTime(2008, 2, 23, 12, 0, 0)).toString("yyyy MMM dd HH:mm:ss") };
testCommon(expectedResults, "/functions/date/to_char.json", "/test_simple_date.json");
}
use of org.joda.time.LocalTime in project serenity-jbehave by serenity-bdd.
the class TimeListConverter method convertValue.
public Object convertValue(String value, Type type) {
Type argumentType = argumentType(type);
List<String> values = trim(asList(value.split(valueSeparator)));
List<LocalTime> times = new ArrayList<>();
for (String string : values) {
times.add((LocalTime) timeConverter.convertValue(string, argumentType));
}
return times;
}
use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParser method fromSingleValue.
public void fromSingleValue(String value, List<OpeningHours> openingHoursList) {
// TODO: 19/07/16 We,Fr-Sa 10:45-19:15, Tu,Sa-Su 05:30-17:30, We 08:00-18:00
OpeningHours openingHours = new OpeningHours();
openingHours.setAllDaysActivated(false);
String[] openingHoursValues = value.split(DAYS_SEP);
String daysPart = null;
String hoursPart = null;
if (value.equals("24/7")) {
daysPart = "Mo-Su";
hoursPart = "24:00-24:00";
} else if (openingHoursValues.length == 2) {
daysPart = openingHoursValues[0];
hoursPart = openingHoursValues[1];
} else if (openingHoursValues.length == 1) {
hoursPart = openingHoursValues[0];
}
if (daysPart != null) {
String[] dayPeriods = daysPart.split(RULE_SEP);
for (String period : dayPeriods) {
if (isPeriod(period)) {
OpeningHours.Days[] d = OpeningHours.Days.fromDatas(period.split(RANGE_SEP));
for (int i = d[0].ordinal(); i <= d[1].ordinal(); i++) {
openingHours.setDayActivated(i, true);
}
} else {
openingHours.setDayActivated(OpeningHours.Days.fromData(period).ordinal(), true);
}
}
}
if (hoursPart != null) {
String[] hours = hoursPart.split(",");
if (hours.length > 1) {
for (String hour : hours) {
value = daysPart + " " + hour;
fromSingleValue(value, openingHoursList);
}
} else {
String[] hourPeriod = hoursPart.split(RANGE_SEP);
LocalTime from = TIME_FORMATTER.parseLocalTime(hourPeriod[0]);
if (hourPeriod.length > 1) {
LocalTime to = TIME_FORMATTER.parseLocalTime(hourPeriod[1]);
openingHours.setToTime(to);
} else {
openingHours.setToTime(from.plusMinutes(5));
}
openingHours.setFromTime(from);
openingHoursList.add(openingHours);
}
}
// return openingHours;
}
use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop1.
@Test
public void isNonStop1() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(0, 0));
openingHours.setToTime(new LocalTime(0, 0));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop2.
@Test
public void isNonStop2() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(0, 0));
openingHours.setToTime(new LocalTime(23, 50));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
Aggregations