【问题标题】:jQuery ionCalendar - how to set the first day of the week to monday日历上的jQuery - 如何将一周的第一天设置为星期一
【发布时间】:2018-04-30 01:56:13
【问题描述】:

我正在使用 jQuery 制作一个简单的日历。我是 Java Script 的绝对初学者。我想将“一周的第一天”更改为星期一,但没有任何效果(我搜索了此页面)。你能帮帮我吗?我想知道我应该在代码中写什么以及在哪里将第一天设置为星期一。

<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <link href="css/ion.calendar.css" rel="stylesheet" type="text/css">
</head>

<body>

  <div id="demo1"></div>
  <div id="result-1">...</div>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script src="js/moment.min.js"></script>
  <script src="js/ion.calendar.js"></script>

  <script>
    //( ".selector" ).datepicker({firstDay: 1});

    $(function() {
      $("#demo1").ionCalendar({
        lang: "sk",
        years: "2000-2050",
        firstDay: 1,
        onClick: function(date) {
          $("#result-1").html("onClick:<br/>" + date);
        }
      });
    });
  </script>

</body>

</html>

【问题讨论】:

    标签: jquery calendar


    【解决方案1】:

    尝试使用sundayFirst 设置为false,如可用Settings 中所述

    一个可选参数,允许您选择日历中一周的第一天。 (例如,在美国,每周从周日开始,而在俄罗斯,每周从周一开始)。如果为 true - 那么第一天将是星期日,如果为 false - 它将是星期一。

    $(function() {
      $("#demo1").ionCalendar({
        lang: "sk",
        years: "2000-2050",
        sundayFirst: false,
        firstDay: 1,
        onClick: function(date) {
          $("#result-1").html("onClick:<br/>" + date);
        }
      });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      • 2020-01-18
      • 2019-08-30
      • 1970-01-01
      • 2013-11-30
      • 2014-08-28
      • 2015-12-11
      相关资源
      最近更新 更多