Replies: 9 comments
-
I also tried the way presented in documentation, but getting the same result methods: {
format_date: function() {
const DATE_FORMAT_US = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/
return {
parse(value = "", createDate) {
const matches = value.match(DATE_FORMAT_US)
if (matches) {
return createDate(matches[3], matches[1], matches[2])
}
},
format(date) {
return ${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}
},
};
}
} this.columns = [
{ prop: 'issue_date', name: 'Issue date', columnType: 'date', identifier: "date", localization: this.localisation_us,
dateAdapter: this.format_date() },
] |
Beta Was this translation helpful? Give feedback.
-
please put your code in JavaScript code block using triple backticks otherwise it's unreadable. |
Beta Was this translation helpful? Give feedback.
-
@JulienGrv sorry did not know how to do it. Thanks for the link, now I know. |
Beta Was this translation helpful? Give feedback.
-
No worries, also add syntax highlighting for Javascript. Example here. |
Beta Was this translation helpful? Give feedback.
-
@JulienGrv oh that's cool! good to know such tricks 😎 |
Beta Was this translation helpful? Give feedback.
-
I am not quite sure if it solves your problem since I have never used the date plugin myself but have you tried to add |
Beta Was this translation helpful? Give feedback.
-
@JulienGrv I have tried it, but it returns string something like "Monday, December 25, 2021, 10:30:21 (London time)" and zero options to control the format anyhow 😩 |
Beta Was this translation helpful? Give feedback.
-
So this what I would do: try to get what you want using duet date picker only then make the necessary changes in the revogrid-column-date plugin and then open a PR so that it gets available for everyone. |
Beta Was this translation helpful? Give feedback.
-
Solved the issue by applying this.columns = [
localization: this.localisation_us,
dateAdapter: this.dateAdapter,
cellTemplate: (createElement, props) => {
return createElement('div' , {
}, props.model[props.prop] ? moment(props.model[props.prop]).format('L') : props.model[props.prop]);
},
] and added to my table validation method that automatically reformat any pasted to cell value to Convert method: convertDate(row) {
if (row.issue_date && row.issue_date !== moment(row.issue_date).format('YYYY-MM-DD')) {
row.issue_date = moment(row.issue_date).format('YYYY-MM-DD')
}
}, |
Beta Was this translation helpful? Give feedback.
-
Please help me understand how to set UTC format for a datepicker when use "Date column type plugin" in Vuejs.
Now I have this settings in columnTypes:
Column settings:
Params stored in vue data()
So datapicker itself shows all in a format I want, but when I press "Enter" it displays
"YYYY-MM-DD"
format, as well as value in vue became same ISO format. And if I copy paste date from excel in format"mm/dd/yyyy"
it does not read it as a date, only if I use datepicker.That is how it works now visually
Beta Was this translation helpful? Give feedback.
All reactions