Open bowencool opened 6 years ago
Translation of this issue:
2.0.7
Windows10 chrome63.0.3239.84 (official version) (64 bit)
2.5.2
https://jsfiddle.net/bowencool/ndkdwyka/1/
See links
Normal display is all right
No normal display of data
@wacky6 Hi, could you take a look at this? Thanks.
Fecha does not support parsing / formatting of week
. I guess element need to hack it somehow? Modify week's parser might solve the problem.
I might consider removing week in value-format
, since it can not accurately indicate a time point (depends on the interpretation of start-of-week, etc).
I might consider removing week in value-format, since it can not accurately indicate a time point (depends on the interpretation of start-of-week, etc).
IMHO it is a valid value format. You are using ISO8601 week numbers and they are always starting with Monday.
Anyways, the error (vue.js:1719 TypeError: e.getTime is not a function
) also happens when you do not use WW
in the value-format
. E.g. in this fiddle I changed the value-format
to yyyy-MM-dd
and the error happens, too.
If you have a el-date-picker[type=week]
and also set the value-format
this error occurs. Looks like el-date-picker[type=week]
cannot handle anything besides a JavaScript Date
object as value
.
This line https://github.com/ElemeFE/element/blob/aaf7a87848d33d3f07310f2865e4d3d14019c6f0/packages/date-picker/src/picker.vue#L167 should probably be
let week = getWeekNumber(isDateObject(value) ? value : parseDate(value, format));
Interesting.
Can you make a PR for it?
I recommend integrate week format into our custom fecha (/src/utils/date.js
)? So date-picker can treat week number as normal dates. (Thus removing custom week picker logic)
@Leopoldthecoder What's the reasoning of current implementation? Will this be a breaking change?
Make fecha support WW
/W
format, so element can drop custom week picker logic, see TYPE_VALUE_RESOLVER_MAP
's week
Any updates on this issue ?
when i set {type="week",value-format="yyyy-W"} ,will meet the same bug! " Error in render: "TypeError: src.getTime is not a function"" please help
Right now, W
is not supported in value-format. Use MM/dd instead.
The definition of W
/ WW
format needs consensus. ISO-8601 week date may be considered in the future.
呜呜呜,终于知道为什么了,花了我半天时间,这磨人的week
why this issue not solved after one year??
当 el-date-picker
像下面这样设置时,输入框的格式一直不正确
<el-date-picker
v-model="value1"
type="week"
format="yyyy 第 W 周"
value-format="yyyy-W"
placeholder="选择周">
</el-date-picker>
same problem here
Hi, can someone add this feature? value-format still not support WW...
I use the computed attribute to parse week. But it's not very convinient.
computed: { week() { return moment(this.date.W).format('YYYY [wk]WW'); } }
Still no update? :(
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still no update? :(
Element UI version
2.0.7
OS/Browsers version
windows10 chrome63.0.3239.84(正式版本) (64 位)
Vue version
2.5.2
Reproduction Link
https://jsfiddle.net/bowencool/ndkdwyka/1/
Steps to reproduce
见链接
What is Expected?
正常展示就行
What is actually happening?
不能正常展示数据