calendar类型显示一个日历,以供用户选择时间日期。

表现形式


 

字段配置参数


专属属性:

  • type (必填) 必须为 calendar
  • default(可选) 默认值。 设置默认的日期。默认值的格式必须和参数设置中的格式一致。如果需要显示当前日期,可以设置为“NOW”.同时也支持JDate类的参数。如:‘now +1 month’ ,‘now +1 day'
  • format(可选) 指定日期的格式。这个是格式将传递个PHP去格式化时间。如果没有指定,则默认为'%Y-%m-%d'  输出 2021-06-10 。如果设置了showtime 为 true,那么还需要指定时间的格式。如:%Y-%m-%d %H:%M:%S'
  • filter(可选) 用来指定时区。有两个可选值 server_utc 或者 user_utc.第一个值使用服务器的时区,第二个值使用用户在全局设置中时区。
  • translateformate(可选) 如果设置为true,那么日期将使用 DATE_FORMAT_CALENDAR_DATE 作为语言字符串(showtime 设置为true时),或者使用DATE_FORMAT_CALENDAR_DATETIME(showtime设置为false时)。如果本参数设置为true,那么foramt参数将自动失效。
  • showtime(可选) 是否显示时间。默认为false
  • timeformat (可选) 时间的格式。可以赊账为12 或者24. 当设置为12时,将显示AM,PM。这个设置将不会影响时间在数据库中的存储。
  • singlehead(可选)如果设置为false,那么年和月的选择器将分开为两行。默认为false
  • todaybutton(可选)如果设置为true,将会显示今天的按钮。默认为true
  • weeknumbers(可选)如果设置为true,将显示日期是当年的第几周。默认为true
  • filltable(可选)如果设置为true,将显示上一个月和下一个月的按钮,默认为true
  • minyear(可选)设置年份的最小年份,如(-10,2),这个值是相对于当前年份的。如果超过这个值得设置将不能选择。默认为0表示没有限制
  • maxyear(可选)设置年份的最小年份,如(-10,2),这个值是相对于当前年份的。如果超过这个值得设置将不能选择。默认为0表示没有限制

 通用属性:

  • name (必填)  能代表该字段的唯一的名称.
  • label (选填) (支持多语言机制) 字段的标题
  • description (选填) (支持多语言机制) 该字段的描述信息。当鼠标移动到标签上面的时候,会以tooltip的形式显示出来.
  • default (选填) (不支持多语言机制) 默认值
  • class (选填) 表单字段的css类名。如果省略,默认为'text_area'.
  • required (选填l)  是否必须填写内容,用于在提交表单是进行校验. ( "true", "1", "readonly"这些都表示true)
  • hint 显示在html占位符元素中的文本,通常是在空白字段内显示的浅色提示
  • readonly (选填l) 是否只读,字段的值不能编辑. ("true", "1", "readonly" 这些都表示true)
  • multiple (选填) 是否允许多选(仅对下拉类型有效) (true or false).
  • useglobal (选填) 是否显示使用全局参数(仅对支持全局参数的类型有效) (true or false).
  • disabled (选填) 是否禁用字段。如果为true,那么这个字段的值不能填写,只能展示 - 并且这个值不会在表单中提交. (可设置的值: "true", "1", "readonly" 这些都表示true)

使用方法


<field 
	name="date" 
	type="calendar" 
default="NOW" label="开始时间" />

备注


日期格式表:

Character Description Example
d Day of the month, 2 digits with leading zeros 01 to 31
a A textual representation of a day, three letters Mon through Sun
e Day of the month without leading zeros 1 to 31
A A full textual representation of the day of the week Monday through Sunday
w Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
j The day of the year (starting from 0) 001 through 366
B A full textual representation of a month January through December
m Numeric representation of a month, with leading zeros 01 through 12
b A short textual representation of a month, three letters Jan through Dec
Y A full numeric representation of a year, 4 digits 1999 or 2003
y A two-digit representation of a year 99 or 03
P Lowercase Ante Meridiem or Post Meridiem am or pm
p Uppercase Ante Meridiem or Post Meridiem AM or PM

作者: 樱木花道

Joomla程序员,从J1.5到J4.x始终都在做Joomla相关开发定制工作,有超过10年行业经验,国内Joomla扩展开发商ZMAX团队的核心成员

作者网站:ZMAX程序人

评论 (0)

  • 最新在前
  • 最佳在前