SHARE
TWEET

Stackoverflow 4597541

a guest Jan 5th, 2011 38 Never
  1. goog.provide('moose.test');
  2.  
  3. goog.require('goog.array');
  4. goog.require('goog.date');
  5.  
  6.  
  7. moose.test = function() {
  8.     var d1 = new goog.date.Date(2010, 12, 24);
  9.     var d2 = new goog.date.Date(2011, 1, 6);
  10.     var d3 = new goog.date.Date(2010, 12, 30);
  11.     var singleDateObject = new goog.date.DateTime(2011, 1, 12, 13, 56, 57);
  12.     var dates = [d1, d2, d3];
  13.     var isIn = goog.array.find(dates, goog.partial(goog.date.isSameDay, singleDateObject));
  14.     var isIt = goog.array.findIndex(dates, function(range) { return goog.date.isSameDay(range, singleDateObject); });
  15.     console.log(isIn);
  16.     console.log(isIt);
  17. };
RAW Paste Data
Top