Skip to content

Instantly share code, notes, and snippets.

@Vloz
Created April 12, 2014 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vloz/10553552 to your computer and use it in GitHub Desktop.
Save Vloz/10553552 to your computer and use it in GitHub Desktop.
Here is a dateinput polymer filter to convert its value to a DateTime.
class DateTimeFromDateInput extends Transformer<String,DateTime>{
String forward(DateTime d){
String s = d.toString();
return s.substring(0,s.lastIndexOf(' '));
}
DateTime reverse(String s) {
try{
return DateTime.parse(s);
}on Exception {
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment