Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A Skuid DatePicker renderer utilizing the HTML5 "date" type
- // Mobile only
- var $ = skuid.$;
- var field = arguments[0];
- var value = arguments[1];
- // Format the date properly for our HTML5 date object
- var formattedDate = skuid.time.formatDate('yy-mm-dd', skuid.time.parseSFDate(value));
- var dateInput = $(field.element.prepend('<input type="Date" value="' + formattedDate +'">'));
- dateInput.on('change', function(e){
- // Split up the value from the "date" typ input
- var val = e.target.value.split('-');
- var year = val[0];
- var month = val[1]-1;
- var day = val[2];
- // Format the value for Salesforce
- var formattedVal = skuid.time.getSFDateTime(new Date(year, month, day));
- // Update our row
- field.model.updateRow( field.row, field.id, formattedVal )
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement