Last active
August 24, 2018 23:08
-
-
Save MaximBalaganskiy/bc15df536942eb546d2fdc7f038b2c0e to your computer and use it in GitHub Desktop.
Datepicker i18n demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
| </head> | |
| <body> | |
| <div aurelia-app="src/configure"> | |
| Loading... | |
| </div> | |
| <script src="https://rawgit.com/aurelia-ui-toolkits/demo-materialize/gh-pages/jspm_packages/system.js"></script> | |
| <script src="https://rawgit.com/aurelia-ui-toolkits/demo-materialize/gh-pages/jspm.config.js"></script> | |
| <script> | |
| System.import("aurelia-bootstrapper"); | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <md-datepicker i18n.bind="i18n" container="body" value.bind="selectedDate" label="Birthday" placeholder="pick a date" year-range.bind="[2000,2005]" first-day="1"></md-datepicker> | |
| </div> | |
| <div> | |
| <button md-button click.delegate="setDate()">set date</button> | |
| </div> | |
| <div> | |
| <span if.bind="selectedDate">You selected (UTC time): ${selectedDate | stringify}</span> | |
| </div> | |
| <div style="margin-top: 15px;"> | |
| The datepicker is initialized with 2000 - 2005 year range and Monday as the first day. | |
| <br/> For full options list see | |
| <a href="http://materializecss.com/pickers.html" target="_blank">Materialize documentation</a>. <b>Bear in mind Aurelia binding conventions, e.g. isRTL becomes is-rtl.</b> | |
| </div> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class App { | |
| selectedDate = null; | |
| i18n = { | |
| months: ["1","2","3","4","5","6","7","8","9","10","11","12"] | |
| } | |
| setDate() { | |
| let date = new Date(); | |
| this.selectedDate = date; | |
| } | |
| } | |
| // tslint:disable-next-line:max-classes-per-file | |
| export class StringifyValueConverter { | |
| toView(value) { | |
| return JSON.stringify(value); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export async function configure(aurelia) { | |
| await aurelia.loader.loadModule("materialize-css"); | |
| aurelia.use | |
| .standardConfiguration() | |
| .developmentLogging() | |
| .plugin("aurelia-materialize-bridge", bridge => bridge.useAll()) | |
| .plugin("aurelia-validation") | |
| .globalResources("src/shared/logger"); | |
| await aurelia.start(); | |
| aurelia.setRoot("src/app"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment