import { shortcut, Widget, print } from "@/core"; import { Msg } from "@/base"; import { DateTimeCombo } from "@/widget"; @shortcut() export class CustomDateTime extends Widget { static xtype = "demo.date_time"; props = {}; render() { const self = this; return { type: "bi.absolute", items: [ { el: { type: "bi.date_time_combo", listeners: [ { eventName: DateTimeCombo.EVENT_CONFIRM, action() { const value = this.getValue(); const date = new Date( value.year, value.month - 1, value.day, value.hour, value.minute, value.second ); const dateStr = print(date, "%Y-%X-%d %H:%M:%S"); Msg.alert("日期", dateStr); }, }, { eventName: DateTimeCombo.EVENT_CANCEL, action() {}, } ], value: { year: 2017, month: 2, day: 23, hour: 12, minute: 11, second: 1, }, }, top: 200, left: 200, } ], }; } }