Asset_config_type is optional, so _published_datetime can be null
171530
public function isValid(\DateTime $lastCacheDate = null): bool
    {
        $publishedDateTime = $this->getLastUpdateDate();

        if ($publishedDateTime && $publishedDateTime < $lastCacheDate) {
            return true;
        }

        return null === $publishedDateTime && null !== $lastCacheDate;
    }
212520
public void setTangoType(final int tangoType, final AttrDataFormat format) throws DevFailed {
        setFormat(format);
        this.tangoType = tangoType;
        enumType = AttributeTangoType.getTypeFromTango(tangoType);
        if (format.equals(AttrDataFormat.SCALAR)) {
            type = enumType.getType();
        } else if (format.equals(AttrDataFormat.SPECTRUM)) {
            type = Array.newInstance(enumType.getType(), 0).getClass();
        } else {
            type = Array.newInstance(enumType.getType(), 0, 0).getClass();
        }
    }
1350351
public void addTangoAttConfigListener(ITangoAttConfigListener listener, boolean stateless)
            throws DevFailed {
        event_listeners.add(ITangoAttConfigListener.class, listener);
        event_identifier = subscribe_att_config_event(attr_name, filters, stateless);
    }
586590
function checkVersionAndSession(config, setSessionTime, callback) {

  var currentTime = (new Date).getTime();

  if(!config){
    writeToConfig({
      checkVersion: currentTime,
      checkSession: currentTime
    }, function(err) {

      return callback(err);
    });
  }

  // console.log(config.checkVersion);

  //config file exists
  // config = JSON.parse(config);
  var itIsCheckVersionTime = currentTime - config.checkVersion > 86400000; // check if module is up-to-date every day
  var itIsCheckSessionTime = currentTime - config.checkSession > 604800000; // refresh session every 7 days

  // console.log(itIsCheckVersionTime, itIsCheckSessionTime, config.checkVersion, config);
  if (itIsCheckVersionTime || typeof(config.checkVersion) === 'undefined') {

    config.checkVersion = currentTime;
    writeToConfig(config, function(err) {


      checkNPMVersion(function(outOfDate, LatestnpmVersion) {

        callback(outOfDate, LatestnpmVersion);
      });

    });

  } else if (itIsCheckSessionTime || typeof(config.checkSession) === 'undefined') {
    // getNewSessionAuth()
    config.checkSession = currentTime;
    writeToConfig(config, function(err) {

      callback();
    });
  }
  callback();

}
142414
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) {

	Calendar c = JREDateTimeUtil.getThreadCalendar(ThreadLocalPageContext.getTimeZone());
	c.setTime(dateTime);
	sb.append(goIn());
	sb.append("new Date(");
	sb.append(c.get(Calendar.YEAR));
	sb.append(",");
	sb.append(c.get(Calendar.MONTH));
	sb.append(",");
	sb.append(c.get(Calendar.DAY_OF_MONTH));
	sb.append(",");
	sb.append(c.get(Calendar.HOUR_OF_DAY));
	sb.append(",");
	sb.append(c.get(Calendar.MINUTE));
	sb.append(",");
	sb.append(c.get(Calendar.SECOND));
	sb.append(");");
    }
16799
private void validateAutoTimestampField(PropertyMetadata propertyMetadata) {
    Class<?> dataClass = propertyMetadata.getDeclaredType();
    if (Collections.binarySearch(VALID_TIMESTAMP_TYPES, dataClass.getName()) < 0) {
      String messageFormat = "Field %s in class %s must be one of the following types - %s";
      throw new EntityManagerException(String.format(messageFormat,
          propertyMetadata.getField().getName(), entityClass, VALID_TIMESTAMP_TYPES));
    }
  }
624997
function timestampsPlugin(schema, options) {

  // Add the fields to the schema
  schema.add({
    createdAt: {
      type: Date,
      'default': Date.now
    },
    updatedAt: {
      type: Date,
      'default': Date.now
    },
    deletedAt: {
      type: Date,
      sparse: true
    }
  });

  // Define the pre save hook
  schema.pre('save', function (next) {
    this.updatedAt = new Date();
    next();
  });

  // Create an index on all the paths
  schema.path('createdAt').index(true);
  schema.path('updatedAt').index(true);
  schema.path('deletedAt').index(true);
}
262125
def build_pub_dates(article, pub_dates):
    ""
    for pub_date in pub_dates:
        # always want a date type, take it from pub-type if must
        if pub_date.get('date-type'):
            date_instance = ea.ArticleDate(pub_date.get('date-type'),
                                           pub_date.get('date'))
        elif pub_date.get('pub-type'):
            date_instance = ea.ArticleDate(pub_date.get('pub-type'),
                                           pub_date.get('date'))
        # Set more values
        utils.set_attr_if_value(date_instance, 'pub_type', pub_date.get('pub-type'))
        utils.set_attr_if_value(date_instance, 'publication_format',
                                pub_date.get('publication-format'))
        utils.set_attr_if_value(date_instance, 'day', pub_date.get('day'))
        utils.set_attr_if_value(date_instance, 'month', pub_date.get('month'))
        utils.set_attr_if_value(date_instance, 'year', pub_date.get('year'))
        article.add_date(date_instance)
1019583
function (type, group) {
    if (!config.assets) throw('No assets found in config');
    var t = config.assets[type];
    if (!t) throw('Asset type not found: ' + type);
    var g = t[group];
    if (!g) throw('Asset group not found: ' + group);

    if (!_.isArray(g)) g = [g];
    return _.chain(g).map(function (f) {
        return fss.source(f);
    }).map(function (f) {
        if (fs.lstatSync(f).isDirectory()) return fss.allSourceFilePaths(f);
        return f;
    }).flatten().uniq().filter(function (f) {
        var process = fss.isProcessableFile(f);
        var include = !fss.isHelperFile(_.last(f.split('/')));
        return process && include && !assetFileTypeMismatch(type, f);
    }).value();
}
648220
public static void fillItemDefault(Item resourceItem, CmsObject cms, CmsResource resource, Locale locale) {

        if (resource == null) {
            LOG.error("Error rendering item for 'null' resource");
            return;
        }

        if (resourceItem == null) {
            LOG.error("Error rendering 'null' item for resource " + resource.getRootPath());
            return;
        }
        if (cms == null) {
            cms = A_CmsUI.getCmsObject();
            LOG.warn("CmsObject was 'null', using thread local CmsObject");
        }
        CmsResourceUtil resUtil = new CmsResourceUtil(cms, resource);
        Map<String, CmsProperty> resourceProps = null;
        try {
            List<CmsProperty> props = cms.readPropertyObjects(resource, false);
            resourceProps = new HashMap<String, CmsProperty>();
            for (CmsProperty prop : props) {
                resourceProps.put(prop.getName(), prop);
            }
        } catch (CmsException e1) {
            LOG.debug("Unable to read properties for resource '" + resource.getRootPath() + "'.", e1);
        }
        I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource);
        if (resourceItem.getItemProperty(PROPERTY_TYPE_ICON) != null) {
            resourceItem.getItemProperty(PROPERTY_TYPE_ICON).setValue(
                new CmsResourceIcon(resUtil, resource.getState(), true));
        }

        if (resourceItem.getItemProperty(PROPERTY_PROJECT) != null) {
            Label projectFlag = null;
            switch (resUtil.getProjectState().getMode()) {
                case 1:
                    projectFlag = new Label(
                        new CmsCssIcon(OpenCmsTheme.ICON_PROJECT_CURRENT).getHtml(resUtil.getLockedInProjectName()),
                        ContentMode.HTML);
                    break;
                case 2:
                    projectFlag = new Label(
                        new CmsCssIcon(OpenCmsTheme.ICON_PROJECT_OTHER).getHtml(resUtil.getLockedInProjectName()),
                        ContentMode.HTML);
                    break;
                case 5:
                    projectFlag = new Label(
                        new CmsCssIcon(OpenCmsTheme.ICON_PUBLISH).getHtml(resUtil.getLockedInProjectName()),
                        ContentMode.HTML);
                    break;
                default:
            }
            resourceItem.getItemProperty(PROPERTY_PROJECT).setValue(projectFlag);
        }

        if (resourceItem.getItemProperty(PROPERTY_INSIDE_PROJECT) != null) {
            resourceItem.getItemProperty(PROPERTY_INSIDE_PROJECT).setValue(Boolean.valueOf(resUtil.isInsideProject()));
        }

        if (resourceItem.getItemProperty(PROPERTY_RELEASED_NOT_EXPIRED) != null) {
            resourceItem.getItemProperty(PROPERTY_RELEASED_NOT_EXPIRED).setValue(
                Boolean.valueOf(resUtil.isReleasedAndNotExpired()));
        }

        if (resourceItem.getItemProperty(PROPERTY_RESOURCE_NAME) != null) {
            resourceItem.getItemProperty(PROPERTY_RESOURCE_NAME).setValue(resource.getName());
        }

        if (resourceItem.getItemProperty(PROPERTY_SITE_PATH) != null) {
            resourceItem.getItemProperty(PROPERTY_SITE_PATH).setValue(cms.getSitePath(resource));
        }

        if ((resourceItem.getItemProperty(PROPERTY_TITLE) != null) && (resourceProps != null)) {
            resourceItem.getItemProperty(PROPERTY_TITLE).setValue(
                resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_TITLE)
                ? resourceProps.get(CmsPropertyDefinition.PROPERTY_TITLE).getValue()
                : "");
        }
        boolean inNavigation = false;
        if ((resourceItem.getItemProperty(PROPERTY_NAVIGATION_TEXT) != null) && (resourceProps != null)) {
            resourceItem.getItemProperty(PROPERTY_NAVIGATION_TEXT).setValue(
                resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_NAVTEXT)
                ? resourceProps.get(CmsPropertyDefinition.PROPERTY_NAVTEXT).getValue()
                : "");
            inNavigation = resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_NAVTEXT);
        }

        if ((resourceItem.getItemProperty(PROPERTY_NAVIGATION_POSITION) != null) && (resourceProps != null)) {
            try {
                Float navPos = resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_NAVPOS)
                ? Float.valueOf(resourceProps.get(CmsPropertyDefinition.PROPERTY_NAVPOS).getValue())
                : (inNavigation ? Float.valueOf(Float.MAX_VALUE) : null);
                resourceItem.getItemProperty(PROPERTY_NAVIGATION_POSITION).setValue(navPos);
                inNavigation = navPos != null;
            } catch (Exception e) {
                LOG.debug("Error evaluating navPos property", e);
            }
        }

        if (resourceItem.getItemProperty(PROPERTY_IN_NAVIGATION) != null) {
            if (inNavigation
                && (resourceProps != null)
                && resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_NAVINFO)
                && CmsClientSitemapEntry.HIDDEN_NAVIGATION_ENTRY.equals(
                    resourceProps.get(CmsPropertyDefinition.PROPERTY_NAVINFO).getValue())) {
                inNavigation = false;
            }
            resourceItem.getItemProperty(PROPERTY_IN_NAVIGATION).setValue(Boolean.valueOf(inNavigation));
        }

        if ((resourceItem.getItemProperty(PROPERTY_COPYRIGHT) != null) && (resourceProps != null)) {
            resourceItem.getItemProperty(PROPERTY_COPYRIGHT).setValue(
                resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_COPYRIGHT)
                ? resourceProps.get(CmsPropertyDefinition.PROPERTY_COPYRIGHT).getValue()
                : "");
        }

        if ((resourceItem.getItemProperty(PROPERTY_CACHE) != null) && (resourceProps != null)) {
            resourceItem.getItemProperty(PROPERTY_CACHE).setValue(
                resourceProps.containsKey(CmsPropertyDefinition.PROPERTY_CACHE)
                ? resourceProps.get(CmsPropertyDefinition.PROPERTY_CACHE).getValue()
                : "");
        }

        if (resourceItem.getItemProperty(PROPERTY_RESOURCE_TYPE) != null) {
            resourceItem.getItemProperty(PROPERTY_RESOURCE_TYPE).setValue(
                CmsWorkplaceMessages.getResourceTypeName(locale, type.getTypeName()));
        }

        if (resourceItem.getItemProperty(PROPERTY_IS_FOLDER) != null) {
            resourceItem.getItemProperty(PROPERTY_IS_FOLDER).setValue(Boolean.valueOf(resource.isFolder()));
        }

        if (resourceItem.getItemProperty(PROPERTY_SIZE) != null) {
            if (resource.isFile()) {
                resourceItem.getItemProperty(PROPERTY_SIZE).setValue(Integer.valueOf(resource.getLength()));
            }
        }

        if (resourceItem.getItemProperty(PROPERTY_PERMISSIONS) != null) {
            resourceItem.getItemProperty(PROPERTY_PERMISSIONS).setValue(resUtil.getPermissionString());
        }

        if (resourceItem.getItemProperty(PROPERTY_DATE_MODIFIED) != null) {
            resourceItem.getItemProperty(PROPERTY_DATE_MODIFIED).setValue(Long.valueOf(resource.getDateLastModified()));
        }

        if (resourceItem.getItemProperty(PROPERTY_USER_MODIFIED) != null) {
            resourceItem.getItemProperty(PROPERTY_USER_MODIFIED).setValue(resUtil.getUserLastModified());
        }

        if (resourceItem.getItemProperty(PROPERTY_DATE_CREATED) != null) {
            resourceItem.getItemProperty(PROPERTY_DATE_CREATED).setValue(Long.valueOf(resource.getDateCreated()));
        }

        if (resourceItem.getItemProperty(PROPERTY_USER_CREATED) != null) {
            resourceItem.getItemProperty(PROPERTY_USER_CREATED).setValue(resUtil.getUserCreated());
        }

        if (resourceItem.getItemProperty(PROPERTY_DATE_RELEASED) != null) {
            long release = resource.getDateReleased();
            if (release != CmsResource.DATE_RELEASED_DEFAULT) {
                resourceItem.getItemProperty(PROPERTY_DATE_RELEASED).setValue(Long.valueOf(release));
            } else {
                resourceItem.getItemProperty(PROPERTY_DATE_RELEASED).setValue(null);
            }
        }

        if (resourceItem.getItemProperty(PROPERTY_DATE_EXPIRED) != null) {
            long expire = resource.getDateExpired();
            if (expire != CmsResource.DATE_EXPIRED_DEFAULT) {
                resourceItem.getItemProperty(PROPERTY_DATE_EXPIRED).setValue(Long.valueOf(expire));
            } else {
                resourceItem.getItemProperty(PROPERTY_DATE_EXPIRED).setValue(null);
            }
        }

        if (resourceItem.getItemProperty(PROPERTY_STATE_NAME) != null) {
            resourceItem.getItemProperty(PROPERTY_STATE_NAME).setValue(resUtil.getStateName());
        }

        if (resourceItem.getItemProperty(PROPERTY_STATE) != null) {
            resourceItem.getItemProperty(PROPERTY_STATE).setValue(resource.getState());
        }

        if (resourceItem.getItemProperty(PROPERTY_USER_LOCKED) != null) {
            resourceItem.getItemProperty(PROPERTY_USER_LOCKED).setValue(resUtil.getLockedByName());
        }
    }
458393
protected function registerAssetPublishCommand(): void
    {
        $this->app->singleton('command.asset.publish', function (Application $app) {
            return new AssetPublishCommand($app->make('asset.publisher'));
        });
    }
1173283
def get_load_times(self, asset_type):
        
        load_times = []
        search_str = '{0}_load_time'.format(asset_type)
        for har_page in self.pages:
            val = getattr(har_page, search_str, None)
            if val is not None:
                load_times.append(val)
        return load_times
767658
private function getDateFromSchemaOrg(): ?\DateTime {
        $dt = null;

        // Check for HTML tags (<meta>, <time>, etc.)
        $nodes = $this->article()->getRawDoc()->find('*[itemprop="datePublished"]');

        /* @var $node Element */
        foreach ($nodes as $node) {
            try {
                if ($node->hasAttribute('datetime')) {
                    $dt = new \DateTime($node->getAttribute('datetime'));
                    break;
                }
                if ($node->hasAttribute('content')) {
                    $dt = new \DateTime($node->getAttribute('content'));
                    break;
                }
            }
            catch (\Exception $e) {
                // Do nothing here in case the node has unrecognizable date information.
            }
        }

        if (!is_null($dt)) {
            return $dt;
        }

        // Check for JSON-LD
        $nodes = $this->article()->getRawDoc()->find('script[type="application/ld+json"]');

        /* @var $node Element */
        foreach ($nodes as $node) {
            try {
                $json = json_decode($node->text());
                if (isset($json->datePublished)) {
                    $date = is_array($json->datePublished)
                        ? array_shift($json->datePublished)
                        : $json->datePublished;

                    $dt = new \DateTime($date);
                    break;
                }
            }
            catch (\Exception $e) {
                // Do nothing here in case the node has unrecognizable date information.
            }
        }

        return $dt;
    }
253446
protected function render_published_date(): string
    {
        return '<time class="published entry-date" itemprop="datePublished" datetime="'.
           \esc_attr(\get_the_date('Y-m-d\TH:i:sO', $this->post->get())).'">'.
           \get_the_date(\get_option('date_format'), $this->post->get()).
        '</time>';
    }
1156027
private Optional<TemporalAccessor> touchDate(AuditableBeanWrapper<?> wrapper,
			boolean isNew) {

		Assert.notNull(wrapper, "AuditableBeanWrapper must not be null!");

		Optional<TemporalAccessor> now = dateTimeProvider.getNow();

		Assert.notNull(now, () -> String.format("Now must not be null! Returned by: %s!",
				dateTimeProvider.getClass()));

		now.filter(__ -> isNew).ifPresent(it -> wrapper.setCreatedDate(it));
		now.filter(__ -> !isNew || modifyOnCreation)
				.ifPresent(it -> wrapper.setLastModifiedDate(it));

		return now;
	}
1165861
public RuntimeEnvironmentBuilder addAsset(Resource asset, ResourceType type) {
        if (asset == null || type == null) {
            return this;
        }
        _runtimeEnvironment.addAsset(asset, type);
        return this;
    }
290270
public void addTangoAttConfigListener(ITangoAttConfigListener listener, String attrName, String[] filters)
            throws DevFailed {
        addTangoAttConfigListener(listener, attrName, filters, false);
    }