简体   繁体   English

如何在日历中显示整个月?

[英]How to show whole month in calendar?

I'm using amsul datetimepicker: https://amsul.ca/pickadate.js/date/ 我正在使用amsul datetimepicker: https ://amsul.ca/pickadate.js/date/

Is there any way to show the current month in the calendar view? 有什么方法可以在日历视图中显示当前月份? As you can see in the preview it has previous and next month dates as well. 如您在预览中所见,它也具有上个月和下个月的日期。 I just want to restrict it to 30 or 31 days of the current mont. 我只想将其限制为当前日期的30或31天。

It will be a big help! 这将是一个很大的帮助!

Thanks. 谢谢。

 $('.datepicker').pickadate() 
 .picker__day--outfocus { visibility: hidden; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link href="https://hateable-tests.000webhostapp.com/classic.css" rel="stylesheet"> <link href="https://hateable-tests.000webhostapp.com/classic.date.css" rel="stylesheet"> <link href="https://hateable-tests.000webhostapp.com/classic.time.css" rel="stylesheet"> <script src="https://hateable-tests.000webhostapp.com/picker.js"></script> <script src="https://hateable-tests.000webhostapp.com/legacy.js"></script> <script src="https://hateable-tests.000webhostapp.com/picker.date.js"></script> <script src="https://hateable-tests.000webhostapp.com/picker.time.js"></script> <input type="text" class="datepicker"> 

Unfortunately the amsul datepicker doesn't offer a built-in function to do this. 不幸的是,amsul datepicker没有提供内置功能来执行此操作。 You can fake it using some custom css however. 您可以使用一些自定义CSS伪造它。 Essentially overwrite the styles for picker__nav--prev & picker__nav--next and make them invisible. 本质上覆盖了picker__nav--prevpicker__nav--next的样式,并使它们不可见。

To hide the days of the previous month/the next month in the current month's view you have to overwrite the style for picker__day--outfocus . 要在当前月份的视图中隐藏上个月/下个月的日期,您必须覆盖picker__day-outfocus的样式。

 $('.datepicker').pickadate(); 
 .picker__nav--prev { visibility: hidden; } .picker__nav--next { visibility: hidden; } .picker__day--outfocus { visibility: hidden; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link href="https://hateable-tests.000webhostapp.com/classic.css" rel="stylesheet"> <link href="https://hateable-tests.000webhostapp.com/classic.date.css" rel="stylesheet"> <link href="https://hateable-tests.000webhostapp.com/classic.time.css" rel="stylesheet"> <script src="https://hateable-tests.000webhostapp.com/picker.js"></script> <script src="https://hateable-tests.000webhostapp.com/legacy.js"></script> <script src="https://hateable-tests.000webhostapp.com/picker.date.js"></script> <script src="https://hateable-tests.000webhostapp.com/picker.time.js"></script> <input type="text" class="datepicker"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM