InputDateTime Control

The InputDateTime control combines two controls into one: InputDate and InputTime. This makes it easier to edit the date and time parts of a Date object, without binding to mulitple controls.

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as wijmo from '@grapecity/wijmo'; import * as input from '@grapecity/wijmo.input'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // edit date and time using an InputDateTime let theInputDateTime = new input.InputDateTime('#theInputDateTime', { valueChanged: (sender) => showDateTime(sender.value) }); // // initialize the date/time value let dt = new Date(); dt.setHours(17, 30, 0); theInputDateTime.value = dt; // // show changes function showDateTime(value) { let el = document.querySelector('#dateTime'); el.textContent = wijmo.Globalize.format(value, 'F'); } } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputDateTime Overview</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div class="form-group"> <label for="theInputDateTime">InputDateTime:</label> <input id="theInputDateTime"> </div> <p> The current date/time is:<b><span id="dateTime"></span></b>. </p> </div> </body> </html> label { width: 120px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjInputModule } from '@grapecity/wijmo.angular2.input'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { date: Date; constructor() { this.date = new Date() this.date.setHours(17, 30, 0); } } // @NgModule({ imports: [WjInputModule, BrowserModule], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputDateTime Overview</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <div class="form-group"> <label for="theInputDateTime">InputDateTime:</label> <wj-input-date-time #theInputDateTime id="theInputDateTime" [value]="date"> </wj-input-date-time> </div> <p> The current date/time is:<b>{{ theInputDateTime.value | date:'EEEE, MMMM d, y, h:mm:ss a'}}</b>. </p> </div> label { width: 120px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } <template> <div class="container-fluid"> <div class="form-group"> <label for="theInputDateTime">InputDateTime:</label> <wj-input-date-time id="theInputDateTime" :value="date" :initialized="initDateTime"> </wj-input-date-time> </div> <p> The current date/time is:<b>{{ theInputDateTime.value | formatDateTime }}</b>. </p> </div> </template> <script> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.core'; import '@grapecity/wijmo.vue2.input'; let App = Vue.extend({ name: 'app', data: function () { let date = new Date(); date.setHours(17, 30, 0); return { date: date, theInputDateTime: {} } }, methods: { initDateTime: function(dateTime){ this.theInputDateTime = dateTime; } }, filters: { formatDateTime: function(value){ return wijmo.Globalize.format(value, 'F'); } } }) let vm = new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> label { width: 120px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputDateTime Overview</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wijmo from '@grapecity/wijmo'; import * as wjInput from '@grapecity/wijmo.react.input'; // class App extends React.Component { constructor(props) { super(props); let date = new Date(); date.setHours(17, 30, 0); this.state = { date: date }; } render() { return <div className="container-fluid"> <div className="form-group"> <label htmlFor="theInputDateTime">InputDateTime:</label> <wjInput.InputDateTime id="theInputDateTime" value={this.state.date} valueChanged={this._onValueChanged.bind(this)}> </wjInput.InputDateTime> </div> <div> The current date/time is:<b>{this._formatDateTime(this.state.date)}</b>. </div> </div>; } _formatDateTime(value) { return wijmo.Globalize.format(value, 'F'); } _onValueChanged(sender) { this.setState({ date: sender.value }); } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> label { width: 120px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; }