MCPcopy Create free account
hub / github.com/bytedance/bolt / fromDateString

Function fromDateString

bolt/type/TimestampConversion.cpp:710–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710int64_t fromDateString(
711 const char* str,
712 size_t len,
713 bool* nullOutput,
714 bool sparkCompatible) {
715 int64_t daysSinceEpoch;
716 size_t pos = 0;
717
718 if (tryParseDateString(
719 str, len, pos, daysSinceEpoch, kStrict, sparkCompatible) !=
720 DateParseResult::kSuccess) {
721 if (nullOutput != nullptr) {
722 *nullOutput = true;
723 return 0;
724 } else {
725 BOLT_USER_FAIL(
726 "Unable to parse date value: \"{}\", expected format is (YYYY-MM-DD)",
727 std::string(str, len));
728 }
729 }
730 return daysSinceEpoch;
731}
732
733static bool isInvalidDate(int year, int month, int day) {
734 static bool MONTH_OF_31_DAYS[] = {

Callers

nothing calls this directly

Calls 1

tryParseDateStringFunction · 0.85

Tested by

no test coverage detected