Overwrites the original method to generate localized date strings.
435533
def date_to_string(date, lang = lang)
      local_date_string(date, Localization::DATE_FMT_SHORT[lang], lang)
    end
630759
def _override_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
        
        self.locale = locale
        self.pull.cache_clear()
        self.pull()
1170042
private String zGetStandardTextFieldDateString(LocalDate date) {
        if (settings == null) {
            return "";
        }
        String standardDateString = "";
        if (date == null) {
            return standardDateString;
        }
        if (date.getEra() == IsoEra.CE) {
            standardDateString = date.format(settings.getFormatForDatesCommonEra());
        } else {
            standardDateString = date.format(settings.getFormatForDatesBeforeCommonEra());
        }
        return standardDateString;
    }
1102520
def _CopyDateFromString(self, date_string):
    
    date_string_length = len(date_string)

    # The date string should at least contain 'YYYY-MM-DD'.
    if date_string_length < 10:
      raise ValueError('Date string too short.')

    if date_string[4] != '-' or date_string[7] != '-':
      raise ValueError('Invalid date string.')

    try:
      year = int(date_string[0:4], 10)
    except ValueError:
      raise ValueError('Unable to parse year.')

    try:
      month = int(date_string[5:7], 10)
    except ValueError:
      raise ValueError('Unable to parse month.')

    try:
      day_of_month = int(date_string[8:10], 10)
    except ValueError:
      raise ValueError('Unable to parse day of month.')

    days_per_month = self._GetDaysPerMonth(year, month)
    if day_of_month < 1 or day_of_month > days_per_month:
      raise ValueError('Day of month value out of bounds.')

    return year, month, day_of_month
25531
private DateFormat createFormatter(Locale loc, String pattern) throws JspException {
        // Apply pattern, if present
        if (pattern != null) {
            return new SimpleDateFormat(pattern, loc);
        }

        if ((type == null) || DATE.equalsIgnoreCase(type)) {
            int style = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
            return DateFormat.getDateInstance(style, loc);
        } else if (TIME.equalsIgnoreCase(type)) {
            int style = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
            return DateFormat.getTimeInstance(style, loc);
        } else if (DATETIME.equalsIgnoreCase(type)) {
            int style1 = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
            int style2 = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
            return DateFormat.getDateTimeInstance(style1, style2, loc);
        } else {
            throw new JspException(Resources.getMessage("FORMAT_DATE_INVALID_TYPE", type));
        }
    }
86919
private void updateDateTimeFormats(ProjectProperties properties)
   {
      String[] timePatterns = getTimePatterns(properties);
      String[] datePatterns = getDatePatterns(properties);
      String[] dateTimePatterns = getDateTimePatterns(properties, timePatterns);

      m_dateTimeFormat.applyPatterns(dateTimePatterns);
      m_dateFormat.applyPatterns(datePatterns);
      m_timeFormat.applyPatterns(timePatterns);

      m_dateTimeFormat.setLocale(m_locale);
      m_dateFormat.setLocale(m_locale);

      m_dateTimeFormat.setNullText(m_nullText);
      m_dateFormat.setNullText(m_nullText);
      m_timeFormat.setNullText(m_nullText);

      m_dateTimeFormat.setAmPmText(properties.getAMText(), properties.getPMText());
      m_timeFormat.setAmPmText(properties.getAMText(), properties.getPMText());
   }
611943
public void setLocale(Locale locale) {
		if (locale == getLocale() || ignoreDatePatternChange) {
			return;
		}

		super.setLocale(locale);
		dateFormatter = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
		setToolTipText(dateFormatter.toPattern());

		setDate(date, false);
		doLayout();
	}
421052
function fixInvalidDate(dateString) {
  if (!dateString) {
    return;
  }

  //Convert invalid dates' timezones to GMT using timezoneMap
  dateString = dateString.replace(/BST?/i, function (match) {
    return timezoneMap[match];
  });

  //Some dates come in as ET, CT etc.. and some don't have the correct offset.
  //Matches /ET/EDT/EST/CT/CDT/CST/MT/MDT/MST/PT/PDT/PST if found at the end of a date string
  var newDateString = dateString.replace(/(E|C|M|P)[DS+]?T$/i, function (match) {
    var firstChar = match.charAt(0);
    return isDaylightSavingsTime() ? (firstChar + 'DT') : (firstChar + 'ST');
  });

  return new Date(newDateString);
}
1044474
def replace(self, **kwargs):
        
        return Date(kwargs.get("year", self.__year),
                    kwargs.get("month", self.__month),
                    kwargs.get("day", self.__day))
717681
function generateDay(name, day, month, year, zeroes, dateObject) {
  var returnObject = {};

  returnObject.day = day;
  returnObject[name] = name;
  if (zeroes) returnObject.dayFormat = ('0' + day).slice(-2);
  if (dateObject) returnObject.date = new Date(year, month, day);
  return returnObject;
}
478896
@Override
    public String render(Date date, Locale locale,  Map<String, Object> model) {
        ConcurrentDateFormatAccess dateFormatter = new ConcurrentDateFormatAccess(dateFormat);
        return dateFormatter.convertDateToString(date);
    }
1356143
function toLocalIsoString(date, includeMillis) {
    if (includeMillis === undefined) {
        includeMillis = false;
    }
    const pad = (n, length, padChar) => {
        if (length === undefined) { length = 2; }
        if (padChar === undefined) { padChar = "0"; }
        let str = "" + n;
        while (str.length < length) {
            str = padChar + str;
        }
        return str;
    };
    const getOffsetFromUTC = () => {
        const offset = date.getTimezoneOffset();
        if (offset === 0) {
            return "Z";
        }
        return (offset < 0 ? "+" : "-")
            + pad(Math.abs(offset / 60), 2) + ":"
            + pad(Math.abs(offset % 60), 2);
    };
    return date.getFullYear() + "-"
        + pad(date.getMonth() + 1) + "-"
        + pad(date.getDate()) + "T"
        + pad(date.getHours()) + ":"
        + pad(date.getMinutes()) + ":"
        + pad(date.getSeconds())
        + (includeMillis ? "." + pad(date.getMilliseconds(), 3) : "")
        + getOffsetFromUTC();
}
1009379
def _generate_timezone(date, local_tz):
    
    offset = _calculate_offset(date, local_tz)

    hour = abs(offset) // 3600
    minute = abs(offset) % 3600 // 60

    if offset < 0:
        return '%c%02d:%02d' % ("-", hour, minute)
    else:
        return '%c%02d:%02d' % ("+", hour, minute)
1011638
function getDateTranslation(date, locale, name, width, form, extended) {
    switch (name) {
        case TranslationType.Months:
            return getLocaleMonthNames(locale, form, width)[date.getMonth()];
        case TranslationType.Days:
            return getLocaleDayNames(locale, form, width)[date.getDay()];
        case TranslationType.DayPeriods:
            var /** @type {?} */ currentHours_1 = date.getHours();
            var /** @type {?} */ currentMinutes_1 = date.getMinutes();
            if (extended) {
                var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale);
                var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
                var /** @type {?} */ result_1;
                rules.forEach(function (rule, index) {
                    if (Array.isArray(rule)) {
                        // morning, afternoon, evening, night
                        var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
                        var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
                        if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
                            (currentHours_1 < hoursTo ||
                                (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
                            result_1 = dayPeriods_1[index];
                        }
                    }
                    else {
                        // noon or midnight
                        var hours = rule.hours, minutes = rule.minutes;
                        if (hours === currentHours_1 && minutes === currentMinutes_1) {
                            result_1 = dayPeriods_1[index];
                        }
                    }
                });
                if (result_1) {
                    return result_1;
                }
            }
            // if no rules for the day periods, we use am/pm by default
            return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 12 ? 0 : 1];
        case TranslationType.Eras:
            return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1];
    }
}
593211
@Override
  public DurationFormatterFactory setLocale(String localeName) {
    if (!localeName.equals(this.localeName)) {
      this.localeName = localeName;
      if (builder != null) {
          builder = builder.withLocale(localeName);
      }
      if (formatter != null) {
          formatter = formatter.withLocale(localeName);
      }
      reset();
    }
    return this;
  }
20474
def GenerateCalendarDatesFieldValuesTuples(self):
    """"""
    for date, (exception_type, _) in self.date_exceptions.items():
      yield (self.service_id, date, unicode(exception_type))
277430
function generateLocaleExtra(locale, localeData) {
  const dayPeriods = getDayPeriodsNoAmPm(localeData);
  const dayPeriodRules = getDayPeriodRules(localeData);

  let dayPeriodsSupplemental = [];

  if (Object.keys(dayPeriods.format.narrow).length) {
    const keys = Object.keys(dayPeriods.format.narrow);

    if (keys.length !== Object.keys(dayPeriodRules).length) {
      throw new Error(`Error: locale ${locale} has not the correct number of day period rules`);
    }

    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 rules = keys.map(key => dayPeriodRules[key]);

    dayPeriodsSupplemental = [...removeDuplicates([dayPeriodsFormat, dayPeriodsStandalone]), rules];
  }

  return `${HEADER}
const u = undefined;

export default ${stringify(dayPeriodsSupplemental).replace(/undefined/g, 'u')};
`;
}