Comments (9)
@WickyNilliams @RiqueBR The first issue I see here is that you canβt change just one value inside the localization object. You need to pass in the whole object for things to work. Please see the last example on this page: https://duetds.github.io/date-picker/
from date-picker.
Hey @viljamis @WickyNilliams, thank you so much for this! I'll send a wee update of the docs to reflect this at some point this week.
from date-picker.
Hey, would you be able to create a codepen/jsfiddle/whatever which demonstrates your issue? I'm unfamiliar with Vue, so would take me a long time to recreate (and even then, it might not match your setup!). Would make it a lot easier to help out :)
from date-picker.
Hi, absolutely. Here's a link for a quick repro.
https://github.com/RiqueBR/datepicker-test
Thanks for taking the time!
from date-picker.
That's brilliant! How about the dateAdapter? I've been trying to pass as a prop as well an object with those functions and it's not picking up. I've updated the repo.
<template>
<div id="app">
<h1>UoE Datepicker - duet date picker</h1>
<duet-date-picker
:dateAdapter="format_date()"
:localization="localization_uk"/>
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
localization_uk: {
//... lots more to add here
placeholder: 'DD/MM/YYYY'
}
}
},
methods: {
format_date: function() {
const DATE_REGEX = /^20[0-9]{2}-[0,1][0-9]-[0-3][0-9]$/;
return {
parse(value = '', createDate) {
const validated = value.match(DATE_REGEX);
if (validated) {
return createDate(validated[3], validated[2], validated[1]);
}
},
format(date) {
return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`;
}
};
}
}
}
</script>
from date-picker.
By the way, I can submit a wee PR that would cover what we're chatting in here to the docs if that's alright. :)
from date-picker.
I think you need to explicitly tell vue to pass the objects as a property, not an attribute. Since it can't determine which to use, it defaults to attribute. If you look in dev tools you will see dateAdapter="[Object object]"
.
I just tested and this should work:
<duet-date-picker :dateAdapter.prop="format_date()" />
^^^^
This answer on stackoverflow pointed me in the right direction: https://stackoverflow.com/questions/61385404/vuejs-cant-pass-object-to-web-component-using-v-bind
I removed the localization part since it was incomplete and causing errors, but the same is true there once you complete the object. Hope that helps :)
from date-picker.
and yes PRs welcome!
from date-picker.
I've just submitted a PR for what we talked here and will close this issue now. Thanks for the prompt response, appreciate it!
from date-picker.
Related Issues (20)
- Screen readers announce hidden fields when navigating past date-picker-element
- "Uncaught SyntaxError: Cannot use import statement outside a module" error while using parcel v2
- TypeError: Cannot read properties of undefined (reading 'isProxied') HOT 1
- Disable some dates in date picker HOT 2
- Support only having some params set in localization HOT 2
- Have a month and year only selector MM/YYYY
- VoiceOver guidance is unclear after date is selected
- Support for readonly (as opposed to disabled)
- Support 3 letters for weekday names
- isDateDisabled should supply the date in ISO8601 string format
- Custom Element creates opinionated stylesheet with no option to exclude it. Better extract it as an optional import. HOT 1
- Support configuring amount of displayed months HOT 1
- Attribute "increment" is not working with duets date-picker 1.4.0
- Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') HOT 1
- Cannot initialise component in Vue.js 3 HOT 3
- localization | attribute 'locale' does not translate hidden label for day (@duetds/date-picker/custom-element)
- Dates showing in words instead of numbers
- Retain the value after clicking on submit button in a form
- Calendar is not usable at 200%
- Selected element (date) is not properly identified HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from date-picker.