Private: Determine if the year should be separated from the month and day with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US.  Returns true if the date needs a separator.
768149
function isYearSeparator() {
    if (yearSeparator !== null) {
      return yearSeparator;
    }

    var formatter = makeFormatter({day: 'numeric', month: 'short', year: 'numeric'});
    if (formatter) {
      var output = formatter.format(new Date(0));
      yearSeparator = !!output.match(/\d,/);
      return yearSeparator;
    } else {
      return true;
    }
  }
1129933
public static boolean isBirthday(int year, int month, int day) {
		// 验证年
		int thisYear = DateUtil.thisYear();
		if (year < 1900 || year > thisYear) {
			return false;
		}

		// 验证月
		if (month < 1 || month > 12) {
			return false;
		}

		// 验证日
		if (day < 1 || day > 31) {
			return false;
		}
		if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
			return false;
		}
		if (month == 2) {
			if (day > 29 || (day == 29 && false == DateUtil.isLeapYear(year))) {
				return false;
			}
		}
		return true;
	}
560669
public static final String isDate(String str, char delimiter)
    {
        int length = str.length();
        if ( length > 10 ) {
            return null;
        }
        
        int sIdx = 0, eIdx = 0, idx = 0;
        String[] parts = new String[]{null,null,null};
        while ( (eIdx = str.indexOf(delimiter, sIdx)) > -1 ) {
            parts[idx++] = str.substring(sIdx, eIdx);
            sIdx = eIdx + 1;
            if ( idx > 2 ) {
                return null;
            }
        }
        
        if ( sIdx < length ) {
            parts[idx++] = str.substring(sIdx);
        }
        
        if ( idx < 2 || idx > 3 ) {
            return null;
        }
        
        String y, m, d = null;
        if ( idx == 2 ) {
            y = parts[0];
            m = parts[1];
        } else {
            y = parts[0];
            m = parts[1];
            d = parts[2];
        }
        
        //System.out.println(y+","+m+","+d);
        //year format check
        if ( y.length() != 4 || ! StringUtil.isDigit(y) 
                || y.charAt(0) == '0' ) {
            return null;
        }
        
        //month format check
        int len = m.length();
        if ( len < 1 || len > 2 ) {
            return null;
        }
        
        if ( len == 1 ) {
            char chr = m.charAt(0);
            if ( chr < '1' || chr > '9' ) {
                return null;
            }
        } else if ( len == 2 ) {
            char chr1 = m.charAt(0);
            char chr2 = m.charAt(1);
            if ( ! (chr1 == '0' || chr1 == '1') ) {
                return null;
            }
            if ( chr1 == '0' ) {
                if ( chr2 < '1' || chr2 > '9' ) {
                    return null;
                }
            } else if ( chr2 < '0' || chr2 > '2' ) {
                return null;
            }
        }
        
        //day format check
        if ( idx == 3 ) {
            len = d.length();
            if ( len < 1 || len > 2 ) {
                return null;
            }
            
            if ( len == 1 ) {
                char chr = d.charAt(0);
                if ( chr < '1' || chr > '9' ) {
                    return null;
                }
            } else if ( len == 2 ) {
                char chr1 = d.charAt(0);
                char chr2 = d.charAt(1);
                if ( "0123".indexOf(chr1) == -1 ) {
                    return null;
                }
                if ( chr1 < '3' ) {
                    if ( chr2 < '1' && chr2 > '9' ) {
                        return null;
                    }
                } else if ( chr2 < '0' || chr2 > '1' ) {
                    return null;
                }
            }
        }
        
        if ( delimiter == '.' ) {
            return idx == 2 ? (y+"-"+m) : (y+"-"+m+"-"+d);
        }
        
        return str;
    }
767834
def year(date)
      y = date.year.abs.to_s
      return [y, BCE_SUFFIX].join(' ') if (date.year <= -1)
      y
    end
548558
public static boolean isYear(String s) {
        if (isEmpty(s)) return defaultEmptyOK;

        if (!isNonnegativeInteger(s)) return false;
        return ((s.length() == 2) || (s.length() == 4));
    }
491273
function( text ) {
			if(modules.utils.isString(text)){
				text = text.toLowerCase();
				text = modules.utils.trim( text );
				// start with timezone char
				if( text.match(':') && ( modules.utils.startWith(text, 'z') || modules.utils.startWith(text, '-')  || modules.utils.startWith(text, '+') )) {
					return true;
				}
				// has ante meridiem or post meridiem
				if( text.match(/^[0-9]/) &&
					( this.hasAM(text) || this.hasPM(text) )) {
					return true;
				}
				// contains time delimiter but not datetime delimiter
				if( text.match(':') && !text.match(/t|\s/) ) {
					return true;
				}

				// if it's a number of 2, 4 or 6 chars
				if(modules.utils.isNumber(text)){
					if(text.length === 2 || text.length === 4 || text.length === 6){
						return true;
					}
				}
			}
			return false;
		}
218559
function getDateParts (value) {
  if (!value || value.length === 0) {
    return
  }

  if (typeof value === 'object') {
    value = moment(value).format('DD/MM/YYYY')
  }

  const seperator = (value.indexOf('-') !== -1) ? '-' : '/'
  if (value.indexOf('T') !== -1) {
    value = value.substr(0, value.indexOf('T'))
  }
  const parts = value.split(seperator)

  if (seperator === '/') {
    return parts
  }

  return [parts[2], parts[1], parts[0]]
}
1359153
def parse_invalid_date(value)
      return unless value

      parts = value.to_s.split("/")
      return unless parts.size == 3

      month = parts[0].to_i
      day = parts[1].to_i
      year = parts[2].to_i
      return unless month >= 1 && month <= 12 && day >= 1 && day <= 31

      year = add_century_to(year)

      Date.new(year, month, day)
    end
541016
public static boolean isBirthday(CharSequence value) {
		if (isMactchRegex(BIRTHDAY, value)) {
			Matcher matcher = BIRTHDAY.matcher(value);
			if (matcher.find()) {
				int year = Integer.parseInt(matcher.group(1));
				int month = Integer.parseInt(matcher.group(3));
				int day = Integer.parseInt(matcher.group(5));
				return isBirthday(year, month, day);
			}
		}
		return false;
	}
1285525
function yyyymmddDateFromMonthDayYearDate(monthDayYearDate) {
	var yyyy = monthDayYearDate.split(',')[1].trim();
	var dd = monthDayYearDate.split(' ')[1].split(',')[0];
	var mm = '';
	switch (monthDayYearDate.split(' ')[0]) {
		case 'January': 
			mm = '01';
			break;
		case 'February':
			mm = '02';
			break;
		case 'March':
			mm = '03';
			break;
		case 'April':
			mm = '04';
			break;
		case 'May':
			mm = '05';
			break;
		case 'June':
			mm = '06';
			break;
		case 'July':
			mm = '07';
			break;
		case 'August':
			mm = '08';
			break;
		case 'September':
			mm = '09';
			break;
		case 'October':
			mm = '10';
			break;
		case 'November':
			mm = '11';
			break;
		case 'December':
			mm = '12';
			break;
	}
	return yyyy + '-' + mm + '-' + dd;
}
907836
def date(objet):
        
        if objet:
            return "{}/{}/{}".format(objet.day, objet.month, objet.year)
        return ""
1134115
static boolean mayBeDate(String s) {
        if (s == null || s.length() != "yyyy-MM-dd_HH-mm-ss".length()) {
            return false;
        }
        for (int i = 0; i < s.length(); i++) {
            switch (s.charAt(i)) {
                case '-':
                    switch (i) {
                        case 4:
                        case 7:
                        case 13:
                        case 16:
                            break;
                        default:
                            return false;
                    }
                    break;
                case '_':
                    if (i != 10) {
                        return false;
                    }
                    break;
                case '0':
                case '1':
                    switch (i) {
                        case 4: // -
                        case 7: // -
                        case 10: // _
                        case 13: // -
                        case 16: // -
                            return false;
                        default:
                            break;
                    }
                    break;
                case '2':
                    switch (i) {
                        case 4: // -
                        case 5: // months 0-1
                        case 7: // -
                        case 10: // _
                        case 13: // -
                        case 16: // -
                            return false;
                        default:
                            break;
                    }
                    break;
                case '3':
                    switch (i) {
                        case 0: // year will safely begin with digit 2 for next 800-odd years
                        case 4: // -
                        case 5: // months 0-1
                        case 7: // -
                        case 10: // _
                        case 11: // hours 0-2
                        case 13: // -
                        case 16: // -
                            return false;
                        default:
                            break;
                    }
                    break;
                case '4':
                case '5':
                    switch (i) {
                        case 0: // year will safely begin with digit 2 for next 800-odd years
                        case 4: // -
                        case 5: // months 0-1
                        case 7: // -
                        case 8: // days 0-3
                        case 10: // _
                        case 11: // hours 0-2
                        case 13: // -
                        case 16: // -
                            return false;
                        default:
                            break;
                    }
                    break;
                case '6':
                case '7':
                case '8':
                case '9':
                    switch (i) {
                        case 0: // year will safely begin with digit 2 for next 800-odd years
                        case 4: // -
                        case 5: // months 0-1
                        case 7: // -
                        case 8: // days 0-3
                        case 10: // _
                        case 11: // hours 0-2
                        case 13: // -
                        case 14: // minutes 0-5
                        case 16: // -
                        case 17: // seconds 0-5
                            return false;
                        default:
                            break;
                    }
                    break;
                default:
                    return false;
            }
        }
        return true;
    }
349701
function isValid(year, month, date) {
        if (date < 1) {
            return false;
        }

        if (month === 1 && date > 28) {
            return date === 29 && (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0);
        }

        if (month === 3 || month === 5 || month === 8 || month === 10) {
            return date < 31;
        }

        return true;
    }
905692
function formatYear(year) {
    var from, to;

    year = year.split('–');

    if (year.length === 2) {
        from = +year[0];

        if (year[1]) {
            to = +year[1];
        }

        return { from: from, to: to };
    }

    return +year;
}
1273724
function(inst) {
			var allowedChars = (inst.options.multiSelect ? inst.options.multiSeparator :
				(inst.options.rangeSelect ? inst.options.rangeSeparator : ''));
			var literal = false;
			var hasNum = false;
			var dateFormat = inst.get('dateFormat');
			for (var i = 0; i < dateFormat.length; i++) {
				var ch = dateFormat.charAt(i);
				if (literal) {
					if (ch === "'" && dateFormat.charAt(i + 1) !== "'") {
						literal = false;
					}
					else {
						allowedChars += ch;
					}
				}
				else {
					switch (ch) {
						case 'd': case 'm': case 'o': case 'w':
							allowedChars += (hasNum ? '' : '0123456789'); hasNum = true; break;
						case 'y': case '@': case '!':
							allowedChars += (hasNum ? '' : '0123456789') + '-'; hasNum = true; break;
						case 'J':
							allowedChars += (hasNum ? '' : '0123456789') + '-.'; hasNum = true; break;
						case 'D': case 'M': case 'Y':
							return null; // Accept anything
						case "'":
							if (dateFormat.charAt(i + 1) === "'") {
								allowedChars += "'";
							}
							else {
								literal = true;
							}
							break;
						default:
							allowedChars += ch;
					}
				}
			}
			return allowedChars;
		}
1046623
def split_date(value):
    
    if not is_valid_date(value):
        return ('', '', '')

    splited = value.split('-')

    try:
        year = splited[0]
    except IndexError:
        year = ''

    try:
        month = splited[1]
    except IndexError:
        month = ''

    try:
        day = splited[2]
    except IndexError:
        day = ''

    return (year, month, day)
414231
function(year) {
			var date = this._validate(year, this.minMonth, this.minDay,
				$.calendars.local.invalidYear || $.calendars.regionalOptions[''].invalidYear);
			return (date.year() < 0 ? this.local.epochs[0] : this.local.epochs[1]);
		}