nje / jquery-glob Goto Github PK
View Code? Open in Web Editor NEWA jQuery plugin for the globalization of string, date, and number formatting and parsing.
A jQuery plugin for the globalization of string, date, and number formatting and parsing.
Hello,
I active plugin in an text input with this:
//Seta valor e ativa DatePicker
$('#' + colDefinition.Id).val(theValue)
.datepicker({
changeMonth: true,
changeYear: true
});
and activated the plugin correctly.
When I type something in input i receive the follow message:
Line: 972
Error: Object expected
Debugging the plugin the error is on:
/* Extract all possible characters from the date format. */
_possibleChars: function(culture, format) {
// expand single digit formats, then escape regular expression characters.
format = expandFormat( culture.calendar, format );
Apparently the "expandFormat" function does not exist, because it protected in the globalization plugin namespace
I put the "expandFormat" function out the namespace and I receive another error, saying "culture.calendar is undefined".
So I change the activation to:
//Seta valor e ativa DatePicker
$('#' + colDefinition.Id).val(theValue)
.datepicker({
culture: $.culture,
changeMonth: true,
changeYear: true
});
With this alterations I get no error messages anymore, but I can not type anything in textbox
No matter how I try I can't get globalization to work. I get the following error message in firebug:
Globalization is not defined
[Break on this error] })(Globalization);
And herre is the code:
<script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="/Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="/Scripts/jquery.glob.js" type="text/javascript"></script>
<script src="/Scripts/globinfo/Globalization.sv-SE.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$.culture = jQuery.cultures["sv-SE"];
$.preferCulture("sv-SE");
alert($.culture.name);
});
</script>
Oh, and the culture alerted is en for some strange reason. Must be some strange issue because the browser is sv-SE :(
If there are no plan, i'm willing to write one.
For example, this script fails:
$.culture = $.cultures.ru;
$.localize('hello', 'ru', 'world');
$.localize('hello')
TypeError: culture is undefined { message="culture is undefined"}
which breaks all demos.
Perhaps $.format should convert nulls and undefined values to empty strings and invoke .toString() for other non-date/numerics?
I am using
$.format
formats Infinity
in a very peculiar way. I haven't checked it in other cultures, but I suspect $.format(Infinity, 'n0', 'en-GB')
would yield "In.fin.ity"
.
Although I don't think a lot of people will have to deal with values as Inifinity
or -Inifinity
(which also yields "In.fin.ity"
), this is still a bug.
More erroneous behavior:
> $.format(-Infinity, 'n2')
"In.fin.ity,00"
The GITHUB link on the home page is broken.
Hi!
First of all i am thankful for this nice plug-in but i found a problem within.
Problem is when i type in e.g.:
12.123.123.123.123.123.123,123123123
after the values gets saved to the server and read again the value becomes:
12.123.123.123.123.120.000,00
Now i don't know is this issue within plug-in or JS itself because float number has limitation.
Thanks in advance!
Danijel.
Hi,
jQuery.Validation have function format which is on jQuery context same as Globalization plugin format. May be functions need to be covered into namespace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.