开发者

jQuery - Mobile date picker control [closed]

开发者 https://www.devze.com 2023-02-22 07:07 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

开发者_JS百科 Improve this question

Is there a Date Picker control that I could use on jQuery Mobile?

It needs to be able to save dates locally, etc.


Here's one that has some good capabilities:

http://dev.jtsage.com/jQM-DateBox/


There is an experimental calendar. I used it successfully.

Take a look here: http://jquerymobile.com/test/experiments/ui-datepicker/


I am developing a PhoneGap application and where I need datepicker/calender capabilities:

Basically on your page you add algon with CSS and JavaScript code for jQuery Mobile:

<script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.css" />

<div data-role="content">
    <input name="myminutesdate" id="myminutesdate" type="date" data-role="datebox"
           data-options='{"mode": "calbox","dateFormat":"%m/%d/%Y","calUsePickers": true, "calNoHeader": true,"highDates": ["2012-12-07" , "2012-07-12"] }' ></input>

Most importantly:

$("#minutesPage").live('pageshow',function(event) {
    var today = new Date();

    var date = today.getDate();
    var month = (today.getMonth()+1);
    var year = today.getFullYear();

    var todayStr = month+"/"+date+"/"+year;
    $('#myminutesdate').trigger('datebox', {'method':'set', 'value':todayStr});
});

Also, if you don't want a popup, you can make it static.


For a calendar view take a look at the Calendar Control

It works with or without date and time spinners (calendar only is possible). It also integrates with jQuery Mobile Themes, if you're looking for that.


While I was searching for a date picker to use on a mobile devices, I found one (via stackoverflow: https://stackoverflow.com/a/3023446/2100636) that works with jQuery and ui theming. I am adding this one as an answer because it may be good to consider because it's rooted in the idea of functionality. It has options I didn't see with other pickers, and I think I can incorporate it into a responsive/mobile design pretty well. I'll update with my progress if I end up using it.

From their website, http://www.ama3.com/anytime/, the description below sums it up better than I can. It's also licensed under Creative Commons.

For starters, take a look at these DATE/TIME ALTERNATIVES:

12-hour or 24-hour clock
custom date/time format (countless possibilities, including JSON and XML)
date-only, time-only, or specific fields!
date/time range limits
era-selection (BCE/CE, BC/AD, etc.)
start week on any day (Sunday, Monday, etc.)
custom base for 2-digit years (1900, 2000, etc.)
UTC offsets and time zones

Then peep these STYLING CHOICES:

custom labels/languages
custom CSS styles
jQuery UI Theming
jQuery UI Theme Switcher
jQuery ThemeRoller
pop-up or always-present picker
visible or hidden field

It's also PROGRAMMER-FRIENDLY:

easy to implement
easy AJAX validation
easy Date/String conversion, including JSON and XML
create multiple pickers at once
easy removal 
easy to extend

And let's not forget those USABILITY FEATURES:

single-click value selection
double-click select-and-dismiss
WAI-ARIA 1.0 keyboard accessibility
em-based relative-size


http://dev.jtsage.com/jQM-DateBox/

The DateBox is very neat and works well for those still looking.

0

精彩评论

暂无评论...
验证码 换一张
取 消