Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
606 views
in Technique[技术] by (71.8m points)

jquery-ui - 如何根据您的位置对齐日期选择器?(How to align your datepicker be left according to your position?)

I need some help, i have datepicker on bootstrap and want to find a way to position it.

(我需要一些帮助,我在bootstrap上有datepicker,想找到一种放置它的方法。)

According to be left and mine does not do that at help.

(据剩下的,我的不帮忙。)

Please help me to improve my logic below.

(请帮助我改善下面的逻辑。)

Thanks and also want to find a way to make my datepicker be in South African format, 'yy-mm-dd'.

(谢谢,也想找到一种方法使我的日期选择器采用南非格式'yy-mm-dd'。)

Mine shows 'dd-mm-yy', eg 11/24/2019 it does not make.

(矿山显示'dd-mm-yy',例如11/24/2019它没有。)

Please assist, thanks.

(请协助,谢谢。)

  <div class = "container">
     <div align="left">
     <div class="input-daterange input-group" id="datepicker">
       <input type="text" class="input-sm form-control" name="from" 
       placeholder="startdate" width="110"/>
       <span class="input-group-addon">To</span>
       <input type="text" class= "input-sm form-control" 
       placeholder="enddate" width="110"/>
        </div>
       </div>
      </div><br>

      // date functionality
      $(document).ready(function(){
      $('.input-daterange').datepicker({
       dateFormat: "dd.mm.yy",
        "orientation":"left"
        });
      });
  ask by user12443509 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your bootstrap Html should be like this:

(您的引导HTML应该是这样的:)

<div class = "container">
    <div class="row">
        <div class="col d-flex">
            <div class="input-daterange input-group" id="datepicker">
                <input type="text" class="input-sm form-control" name="from" 
                placeholder="startdate" width="110"/>
                <span class="input-group-addon">To</span>
                <input type="text" class= "input-sm form-control" 
                placeholder="enddate" width="110"/>
            </div>        
        </div>
    </div>
</div>

Then it'll be left aligned.

(然后它将保持对齐状态。)

And for dd-mm-yyyy format your script should be like this.

(对于dd-mm-yyyy格式,您的脚本应如下所示。)

// date functionality
$(document).ready(function(){
    $('.input-daterange').datepicker({
         dateFormat: "dd-mm-yy",
         "orientation":"left"
     });
});

I hope it'll help you

(希望对您有帮助)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...