Closed deduka closed 8 years ago
See here: https://github.com/bevacqua/rome#setup
You'll need to configure moment
, which supports internationalization.
can you give me an example? thanks.
hi Deduka, did you find a solution to your problem? I have the same problem I don't find how to configure Moment for Rome
ok, I found. You have to call moment from rome and probably import (or require) a moment locale.
import m from 'mithril';
import Moment from 'moment';
import Rome from 'rome';
import 'moment/locale/fr';
const SideBar = {};
SideBar.controller = function(attrs){
var controller = {};
var today = Moment().format('DD-MM-YYYY');
Rome.moment.locale('fr');
controller.startDateField=function(el,isInitialized){
if(!isInitialized){
Rome(el,{dateValidator:Rome.val.beforeEq(end),inputFormat:"DD-MM-YYYY",max:today,time:false,weekStart:1}).on('data',function(value){
attrs.start(value);
});
}
};
return controller;
};
SideBar.view = function(ctrl,attrs){
return m("div",{class:"nav navbar-nav side-nav well"},[
m("form",{role:"form"},[
m("div",{class:"form-group"},[
m("label",{for:"start",class:"control-label"}, "Début de la période "),
m('input',{type:'text',id:'start',config: ctrl.startDateField})
]),
m("input",{type:"button", class:"btn btn-info btn-sm",name:"interval", value:"valider",onclick:ctrl.clickButton})
])
])
};
export default SideBar;
I use mithril and jspm "el" is like getElement... and import is like require. You can use weekStart option to begin the week at monday in place on sunday.
(sorry for my lows skills in english speaking)
Rome doesn't work in IE, therefore I gived up! To bad. :( I give chance to Pikaday. It works in IE, but doesn't support validation, so you need to implement your own, with additional javascript function.
Oh effectively! Not essential to me but docs says: "Browser support includes every sane browser and IE7+.", hum! Good luck with Pikaday and thanks for your response Deduka.
I tryed it on IE8 and something messed up with css, calendar box was widespread over whole screen. On Firefox and Chrome works correctly. For datepicker, Rome is the best solution i've seen, but IE is peace of s..t and nothing works correctly. I hope Rome will be more stable with IE in newer version.
works smoothly on IE8+ for me, I had to fix some cosmetics though.
This is not issue, but question. Please forgive me, because i am an beginner. :) I want to setup locale for my language bosnian (bs). this is my code:
What and where I need to add? Thanks.