一、Input 类型: week
week 类型允许你选择周和年。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
</head><body><form action="demo-form.php">选择周: <input type="week" name="year_week"><input type="submit">
</form></body>
</html>
二、week c++定义:
third_party\blink\renderer\core\html\forms\week_input_type.h
third_party\blink\renderer\core\html\forms\week_input_type.cc
namespace blink {class WeekInputType final : public BaseTemporalInputType {public:explicit WeekInputType(HTMLInputElement& element): BaseTemporalInputType(Type::kWeek, element) {}private:void CountUsage() override;StepRange CreateStepRange(AnyStepHandling) const override;bool ParseToDateComponentsInternal(const String&,DateComponents*) const override;bool SetMillisecondToDateComponents(double, DateComponents*) const override;void WarnIfValueIsInvalid(const String&) const override;// BaseTemporalInputType functionsString FormatDateTimeFieldsState(const DateTimeFieldsState&) const override;void SetupLayoutParameters(DateTimeEditElement::LayoutParameters&,const DateComponents&) const override;bool IsValidFormat(bool has_year,bool has_month,bool has_week,bool has_day,bool has_ampm,bool has_hour,bool has_minute,bool has_second) const override;String AriaLabelForPickerIndicator() const override;
};template <>
struct DowncastTraits<WeekInputType> {static bool AllowFrom(const InputType& type) {return type.IsWeekInputType();}
};} // namespace blink