Open pdesjardins90 opened 6 years ago
Also maybe that regex shoudn't explode?
removed the error by using .value instead (I'm using Litelement)
The following code is working with me:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<title>vaadin-time-picker Examples</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../vaadin-time-picker.html">
</head>
<body>
<dom-module id="custom-time-picker">
<template>
<style>
:host {
display: block;
}
</style>
<vaadin-time-picker i18n="[[_computei18n(i18n)]]"></vaadin-time-picker>
</template>
<script>
class CustomTimePicker extends Polymer.Element {
static get is() {
return 'custom-time-picker';
}
static get properties () {
return {
i18n: {
type: Object,
value: {}
}
}
}
_formatDayTimeObject(dayTimeObject) {
return dayTimeObject;
}
_parseDisplayedTimeToDayTimeObject(displayedTime) {
return displayedTime;
}
_computei18n(i18n) {
return Object.assign({
formatTime: dayTimeObject => this._formatDayTimeObject(dayTimeObject),
parseTime: displayedTime => this._parseDisplayedTimeToDayTimeObject(displayedTime)
}, i18n);
}
}
customElements.define(CustomTimePicker.is, CustomTimePicker);
</script>
</dom-module>
<custom-time-picker></custom-time-picker>
</body>
</html>
Seems that this is still an issue. If value
gets set before i18n
, it might be that the format of the value isn't compatible with the default parser and you end up with an error.
I have this:
but I get this error just by loading the page where the picker is:
Uncaught SyntaxError: Invalid regular expression: /^(\d|[0-1]\d|2[0-3])(?::(\d|[0-5]\d)(?::(\d|[0-5]\d)(?:\.(\d{1,3}))?)?)?$/: Stack overflow
@ vaadin-time-picker: line 229This should not run as I provide my own i18n object
I'm using vaadin-time-picker v1.0.0-beta1