我希望通过以下代码从具有相同格式的用户获得两个日期(日期格式为JALAL):((主要部分为粗体))
t = [collections.ChainMap({'a': 'ITT002', 'b': {'c': '2', 'd': '2', 'e': '2'}, 'f': '2'}, {'g': {'h1': {'i': '22', 'j': '2', 'k': '2', 'l': '2', 'n': '2'}}})]
print(json.dumps(dict(t[0])))
>>{"f": "2", "g": {"h1": {"i": "22", "j": "2", "k": "2", "l": "2", "n": "2"}}, "b": {"c": "2", "d": "2", "e": "2"}, "a": "ITT002"}
但JALALI格式仅适用于第一个输入,第二个输入更改为格里高利日期。所有"输入"是相同的!!!!!
答案 0 :(得分:0)
您不能像这样调用.setup
方法,Javascript对象不能有重复的键。您必须分别为每个输入调用它:
Calendar.setup({
inputField: 'inputpicker',
button: 'inputpicker',
ifFormat: '%Y-%m-%d',
dateType: 'jalali',
weekNumbers: false
});
Calendar.setup({
inputField: 'inputpickerr',
button: 'inputpickerr',
ifFormat: '%Y-%m-%d',
dateType: 'jalali',
weekNumbers: false
});
此外,如果inputField
和button
键确实包含ID,那么您还有另一个问题 - HTML中的ID必须是唯一的。
答案 1 :(得分:0)
<script type="text/javascript">
Calendar.setup({
inputField: "inputpicker", // id of the input field
button : "inputpicker", // trigger for the calendar (button ID)ID)
ifFormat : "%Y-%m-%d", // format of the input field
dateType : 'jalali',
weekNumbers : false
});
</script>
你有解决我问题的方法吗?