list of words not to let the parser use stops praser returning implied dates against server local time
193850
function constainRestrictedWords(text) {
	var i,
		restictedWords = ['today', 'tomorrow', 'yesterday', 'tonight'];

	text = text.toLowerCase();
	i = restictedWords.length;
	while (i--) {
		if (text.indexOf(restictedWords[i]) > -1) {
			return true;
		}
	}
	return false;
}
86026
def getDateTimeFromGet(request,key):
    '''
    
    '''
    if request.GET.get(key,''):
        try:
            return ensure_timezone(datetime.strptime(unquote(request.GET.get(key,'')),'%Y-%m-%d'))
        except (ValueError, TypeError):
            pass
    return None
997939
function getDateTimeTranslations(localeData) {
  const dayNames = localeData.main(`dates/calendars/gregorian/days`);
  const monthNames = localeData.main(`dates/calendars/gregorian/months`);
  const erasNames = localeData.main(`dates/calendars/gregorian/eras`);
  const dayPeriods = getDayPeriodsAmPm(localeData);

  const dayPeriodsFormat = removeDuplicates([
    objectValues(dayPeriods.format.narrow),
    objectValues(dayPeriods.format.abbreviated),
    objectValues(dayPeriods.format.wide)
  ]);

  const dayPeriodsStandalone = removeDuplicates([
    objectValues(dayPeriods['stand-alone'].narrow),
    objectValues(dayPeriods['stand-alone'].abbreviated),
    objectValues(dayPeriods['stand-alone'].wide)
  ]);

  const daysFormat = removeDuplicates([
    objectValues(dayNames.format.narrow),
    objectValues(dayNames.format.abbreviated),
    objectValues(dayNames.format.wide),
    objectValues(dayNames.format.short)
  ]);

  const daysStandalone = removeDuplicates([
    objectValues(dayNames['stand-alone'].narrow),
    objectValues(dayNames['stand-alone'].abbreviated),
    objectValues(dayNames['stand-alone'].wide),
    objectValues(dayNames['stand-alone'].short)
  ]);

  const monthsFormat = removeDuplicates([
    objectValues(monthNames.format.narrow),
    objectValues(monthNames.format.abbreviated),
    objectValues(monthNames.format.wide)
  ]);

  const monthsStandalone = removeDuplicates([
    objectValues(monthNames['stand-alone'].narrow),
    objectValues(monthNames['stand-alone'].abbreviated),
    objectValues(monthNames['stand-alone'].wide)
  ]);

  const eras = removeDuplicates([
    [erasNames.eraNarrow['0'], erasNames.eraNarrow['1']],
    [erasNames.eraAbbr['0'], erasNames.eraAbbr['1']],
    [erasNames.eraNames['0'], erasNames.eraNames['1']]
  ]);

  const dateTimeTranslations = [
    ...removeDuplicates([dayPeriodsFormat, dayPeriodsStandalone]),
    ...removeDuplicates([daysFormat, daysStandalone]),
    ...removeDuplicates([monthsFormat, monthsStandalone]),
    eras
  ];

  return dateTimeTranslations;
}
1000889
function parseDate(fmt, date) {
    var indexMap = {}; // contains reGroupPosition -> typeLetter or [typeLetter, value array]
    var reIndex = 1;
    var timezoneOffsetMatch;
    var timezoneIndex;
    var match;

    var format = replace(fmt, /^\?/);
    if (format!=fmt && !trim(date))
      return _null;

    if (match = /^\[([+-])(\d\d)(\d\d)\]\s*(.*)/.exec(format)) {
      timezoneOffsetMatch = match;
      format = match[4];
    }

    var parser = new RegExp(format.replace(/(.)(\1*)(?:\[([^\]]*)\])?/g, function(wholeMatch, placeholderChar, placeholderDigits, param) {
      if (/[dmhkyhs]/i.test(placeholderChar)) {
        indexMap[reIndex++] = placeholderChar;
        var plen = placeholderDigits.length+1;
        return "(\\d"+(plen<2?"+":("{1,"+plen+"}"))+")";
      }
      else if (placeholderChar == 'z') {
        timezoneIndex = reIndex;
        reIndex += 3;
        return "([+-])(\\d\\d)(\\d\\d)";
      }
      else if (/[Nna]/.test(placeholderChar)) {
        indexMap[reIndex++] = [placeholderChar, param && param.split(',')];
        return "([a-zA-Z\\u0080-\\u1fff]+)";
      }
      else if (/w/i.test(placeholderChar))
        return "[a-zA-Z\\u0080-\\u1fff]+";
      else if (/\s/.test(placeholderChar))
        return "\\s+";
      else
        return escapeRegExp(wholeMatch);
    }));

    if (!(match = parser.exec(date)))
      return undef;

    var ctorArgs = [0, 0, 0, 0, 0, 0,  0];
    for (var i = 1; i < reIndex; i++) {
      var matchVal = match[i];
      var indexEntry = indexMap[i];
      if (isList(indexEntry)) { // for a, n or N
        var placeholderChar = indexEntry[0];
        var mapEntry  = PARSE_DATE_MAP[placeholderChar];
        var ctorIndex = mapEntry[0];
        var valList = indexEntry[1] || mapEntry[1];
        var listValue = find(valList, function(v, index) { if (startsWith(matchVal.toLowerCase(), v.toLowerCase())) return index; });
        if (listValue == _null)
          return undef;
        if (placeholderChar == 'a')
          ctorArgs[ctorIndex] += listValue * 12;
        else
          ctorArgs[ctorIndex] = listValue;
      }
      else if (indexEntry) { // for numeric values (yHmMs)
        var value = parseFloat(matchVal);
        var mapEntry  = PARSE_DATE_MAP[indexEntry];
        if (isList(mapEntry))
          ctorArgs[mapEntry[0]] += value - mapEntry[1];
        else
          ctorArgs[mapEntry] += value;
      }
    }
    var d = new Date(ctorArgs[0], ctorArgs[1], ctorArgs[2], ctorArgs[3], ctorArgs[4], ctorArgs[5], ctorArgs[6]);
    return dateAdd(d, 'minutes', -getTimezone(timezoneOffsetMatch, 1, d) - getTimezone(match, timezoneIndex, d));
  }
27011
@Override
    public Date parseTime(String input) throws ParseException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "parseTime parsing [" + input + "]");
        }
        String data = input;
        int i = data.indexOf(';', 0);
        // PK20062 - check for excess data following the date value
        if (-1 != i) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Ignoring excess data following semi-colon in date");
            }
            // strip off trailing whitespace before semi-colon
            for (; i > 20; i--) {
                char c = data.charAt(i - 1);
                if (' ' != c && '\t' != c) {
                    break;
                }
            }
            if (20 >= i) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Not enough data left to make a valid date");
                }
                throw new ParseException("Invalid date [" + input + "]", 0);
            }
            data = input.substring(0, i);
        }

        Date parsedDate = attemptParse(getFormat().get1123Parse(), data);
        if (null == parsedDate) {
            parsedDate = attemptParse(getFormat().get1036Parse(), data);
            if (null == parsedDate) {
                parsedDate = attemptParse(getFormat().getAsciiParse(), data);
                if (null == parsedDate) {
                    parsedDate = attemptParse(getFormat().get2109Parse(), data);
                    if (null == parsedDate) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Time does not match supported formats");
                        }
                        throw new ParseException("Unparseable [" + data + "]", 0);
                    }
                }
            }
        }
        return parsedDate;
    }
155974
def _handleParListMismatch(self, probStr, extra=False):
        

        errmsg = 'ERROR: mismatch between default and current par lists ' + \
               'for task "'+self.taskName+'"'
        if probStr:
            errmsg += '\n\t'+probStr
        errmsg += '\n(try: "unlearn '+self.taskName+'")'
        print(errmsg)
        return False
1000339
function parseDate(str/*:string|Date*/, fixdate/*:?number*/)/*:Date*/ {
	var d = new Date(str);
	if(good_pd) {
		/*:: if(fixdate == null) fixdate = 0; */
		if(fixdate > 0) d.setTime(d.getTime() + d.getTimezoneOffset() * 60 * 1000);
		else if(fixdate < 0) d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000);
		return d;
	}
	if(str instanceof Date) return str;
	if(good_pd_date.getFullYear() == 1917 && !isNaN(d.getFullYear())) {
		var s = d.getFullYear();
		if(str.indexOf("" + s) > -1) return d;
		d.setFullYear(d.getFullYear() + 100); return d;
	}
	var n = str.match(/\d+/g)||["2017","2","19","0","0","0"];
	var out = new Date(+n[0], +n[1] - 1, +n[2], (+n[3]||0), (+n[4]||0), (+n[5]||0));
	if(str.indexOf("Z") > -1) out = new Date(out.getTime() - out.getTimezoneOffset() * 60 * 1000);
	return out;
}
399257
def fix_linkdate(self, entry):
        
        if self.sync_by_date:
            try:
                entry.linkdate = list(entry.published_parsed)
                self.linkdate = list(entry.published_parsed)
            except (AttributeError, TypeError):
                try:
                    entry.linkdate = list(entry.updated_parsed)
                    self.linkdate = list(entry.updated_parsed)
                except (AttributeError, TypeError):
                    print(("This entry doesn't seem to have a parseable date. "
                           "I will use your local time instead."),
                          file=sys.stderr, flush=True)
                    entry.linkdate = list(time.localtime())
                    self.linkdate = list(time.localtime())
        else:
            entry.linkdate = list(time.localtime())
799388
def parse_date(value):
    
    if not value:
        return None

    if isinstance(value, datetime.date):
        return value

    return parse_datetime(value).date()
638608
def getparser(use_datetime=0):
    
    if use_datetime and not datetime:
        raise ValueError("the datetime module is not available")
    if FastParser and FastUnmarshaller:
        if use_datetime:
            mkdatetime = _datetime_type
        else:
            mkdatetime = _datetime
        target = FastUnmarshaller(True, False, _binary, mkdatetime, Fault)
        parser = FastParser(target)
    else:
        target = Unmarshaller(use_datetime=use_datetime)
        if FastParser:
            parser = FastParser(target)
        elif SgmlopParser:
            parser = SgmlopParser(target)
        elif ExpatParser:
            parser = ExpatParser(target)
        else:
            parser = SlowParser(target)
    return parser, target
1107531
def QA_util_get_real_date(date, trade_list=trade_date_sse, towards=-1):
    
    date = str(date)[0:10]
    if towards == 1:
        while date not in trade_list:
            date = str(
                datetime.datetime.strptime(str(date)[0:10],
                                           '%Y-%m-%d') +
                datetime.timedelta(days=1)
            )[0:10]
        else:
            return str(date)[0:10]
    elif towards == -1:
        while date not in trade_list:
            date = str(
                datetime.datetime.strptime(str(date)[0:10],
                                           '%Y-%m-%d') -
                datetime.timedelta(days=1)
            )[0:10]
        else:
            return str(date)[0:10]
192160
def parse_datetime_aware(s, tz=None):
    
    assert settings.USE_TZ
    if isinstance(s, datetime.datetime):
        return s
    d = parse_datetime(s)
    if d is None:
        raise ValueError
    return timezone.make_aware(d, tz or timezone.get_current_timezone())
659404
function d3_time_parseWeekdayAbbrev(date, string, i) {
  return d3_time_weekdayAbbrevRe.test(string.substring(i, i += 3)) ? i : -1;
}
65061
function dateStrGetter(name, width, form, extended) {
    if (form === void 0) { form = FormStyle.Format; }
    if (extended === void 0) { extended = false; }
    return function (date, locale) {
        return getDateTranslation(date, locale, name, width, form, extended);
    };
}
1061640
def get_modified_date(parsed, raw):
	''
	if parsed: return feedparser_ts(parsed)
	if not raw: return None

	# Parse weird timestamps that feedparser can't handle, e.g.: July 30, 2013
	ts, val = None, raw.replace('_', ' ')
	if not ts:
		# coreutils' "date" parses virtually everything, but is more expensive to use
		from subprocess import Popen, PIPE
		with open(os.devnull, 'w') as devnull:
			proc = Popen(['date', '+%s', '-d', val], stdout=PIPE, stderr=devnull)
			val = proc.stdout.read()
			if not proc.wait():
				ts = datetime.fromtimestamp(int(val.strip()), tz=timezone.utc)
	if ts: return ts
	raise ValueError('Unrecognized raw value format: {0!r}'.format(val))
301656
function filterDate({
  data,
  value,
  disabledArr,
  minDate,
  maxDate,
  oldData = {},
  props,
  columns,
}) {
  const disabledArrNew = parseDisabledArr(disabledArr);
  if (columns[0] === 'Y') {
    const year = value[0].value;
    let month;
    let yearData = data[0];
    let monthData;
    if (columns.length >= 2) {
      monthData = getMonthsByYear({ year, minDate, maxDate }).map(item => ({
        value: item.value,
        text: `${addZero(item.text)}${locale[props.locale].surfix.M}`,
      }));
      month = value[1].value;
    }
    let dayData;
    if (columns.length >= 3) {
      dayData = getDaysByMonth({
        year, month, minDate, maxDate,
      });
    }
    if (disabledArrNew.startEnd || disabledArrNew.minTime || disabledArrNew.maxTime) {
      if (oldData.yearData) {
        ({ yearData } = oldData);
      } else {
        yearData = filterYear(yearData, { disabledDateObj: disabledArrNew, minDate, maxDate });
      }
      if (monthData) {
        if (oldData.monthData) {
          ({ monthData } = oldData);
        } else {
          const monthArr = filterMonth(monthData, year, disabledArrNew);
          monthData = monthArr.length ? monthArr : monthData;
        }
      }

      if (dayData) {
        const dayArr = filterDay(dayData, year, month, disabledArrNew);
        dayData = dayArr.length ? dayArr : dayData;
        const unit = locale[props.locale].surfix.D;
        dayData = dayData.map(item => ({
          ...item,
          text: addZero(item.text) + (unit || ''),
        }));
      }
    }
    if (disabledArrNew.minTime >= disabledArrNew.maxTime) {
      warn('Datetime: Please check your disabledDate props');
      return [];
    }
    if (!yearData.length) {
      return [];
    }
    const outArr = [yearData];
    if (monthData) {
      outArr.push(monthData);
      if (dayData) {
        outArr.push(dayData);
      }
    }

    if (data[3]) {
      outArr.push(data[3]);
    }
    return outArr;
  }
  if (['YMD', 'YMDW'].indexOf(columns[0]) !== -1) {
    const newData = [...data];
    newData[0] = filterYMDDay(newData[0], disabledArr);

    return newData;
  }
  return data;
}
1340330
def render(self, datestring):
        """"""
        formats = ["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%d %H:%M:%S.%f",
                   "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S"]
        if datestring:
            for format in formats:
                try:
                    parsed = datetime.strptime(datestring, format)
                    if not timezone.is_aware(parsed):
                        parsed = timezone.make_aware(parsed, timezone.utc)
                    return parsed
                except Exception:
                    pass
        return None