Comments (4)
Just finished date formats. You can download /js/w2ui.js or /js/w2ui.min.js to use it. Basically, you can use either standalone fields:
<input type="text" id="dt" value="11/5/1977"/>
<script>
$('#dt').w2field({ type: 'date', format: 'dd/mm/yyyy' });
</script>
Or you can use it as part of the form
$('#form').w2form({
name : 'form',
url : 'server/post',
fields: [
{ name: 'field_date', type: 'date', options: { format: 'Mon dd, yyyy' } },
...
]
});
Formats supported:
mm/dd/yyyy
mm-dd-yyyy
dd/mm/yyyy
dd-mm-yyyy
Mon dd, yyyy
from w2ui.
There is no simple thing a European dates. For example in the Netherlands you write 14/10/1963 for dd/mm/yy,
but in Germany they write it with dots (14.10.1963). So in the w2ui.js you need to add a bit more code to satisfy the Germans too:
if (format.toLowerCase() == 'dd/mm/yyyy' || format.toLowerCase() == 'dd-mm-yyyy' || format.toLowerCase() == 'dd.mm.yyyy') {
val = val.replace(/-/g, '/');
val = val.replace(/\./g, '/');
if (val.split("/").length != 3)
return false;
var month = val.split("/")[1];
var day = val.split("/")[0];
var year = val.split("/")[2];
var obj = new Date(year, month - 1, day);
if ((obj.getMonth() + 1 != month) || (obj.getDate() != day) || (obj.getFullYear() != year))
return false;
return true;
}
Maybe it is a suggestion to add a config object to the w2ui where the date format can be set by the developer, with a method to update it dynamically at initation of w2ui. If you going to use the w2ui for f.e. Wordpress plugins you might want to use the date format from the Wordpress admin settings and then it would be nice that at initiation time of the w2ui driven admin panels you can adjust the date format that is shown to the user is in the format of the Wordpress setup of the user.
from w2ui.
if i used date format dd/mm/yyyy on unix is oke, but on windows is bad.
if date input = 30-09-2013 on post variabel = 29-09-2013
why ...... ????
from w2ui.
Possibly time zone issue. As you know unix time is in GMT.
from w2ui.
Related Issues (20)
- Grid toolbar refresh with multiSearch enabled shows overlapping controls HOT 1
- Clicking in a grid without records generates script error HOT 2
- How can I prevent the loading message tip from appearing when grid.reload is called?
- Update sidebar.topHTML after initialization HOT 4
- Double-clicking on w2tab makes it invisible
- Deselecting a row with a mouse click stopped working. HOT 3
- W2db.php (server/php) doesn't work on PHP8 HOT 1
- w2grid markSearch() not properly escaping values when highlighting search results HOT 4
- Grid context menu does not close, appears multiple times on right clicks
- Grid advanced search script error when searching with empty input
- Weird ENTER key behavior in Inline Edit with selectType = Cell HOT 2
- w2grid.onSelect event not working corectly
- Как в форме в полях вывести Label большой длины, что бы не срезалось наименование поля HOT 2
- w2ui-lock
- w2grid: when property reorderColumns is true, sorting columns doesn't work as expected
- Form in a popup HOT 3
- w2ui grid - password renderer error if password undefined HOT 2
- square button shape HOT 1
- Popup window from another popup window with forms HOT 1
- Экранная форма не масштабируется на весь экран при открытие окна на весь экран HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from w2ui.