<commit_before>import Constants from '../constants/constants';
import Dispatcher from '../dispatcher/dispatcher';
import {EventEmitter} from 'events';
import moment from 'moment';
import shortId from 'shortid';

const CHANGE_EVENT = 'change';
let calendarEvents = new Map();
let idToken = null;

const create = (plant, plantedDate) => {
    const plantedDateMoment = moment.utc(plantedDate);
    if (!plantedDateMoment.isValid()) {
        throw new Error(`Invalid planted date ${plantedDate}`);
    }
    
    const id = shortId.generate();
    const growTime = moment().duration(plant.growTime);
    const readyDate = moment().
        utc(plantedDateMoment).
        add(growTime).
        toISOString();
    
    return calendarEvents.set(
        id,
        {
            id: id,
            plant: plant,
            plantedDate: plantedDateMoment.toISOString(),
            readyDate: readyDate,<commit_msg>Duration does not exist<commit_after>import Constants from '../constants/constants';
import Dispatcher from '../dispatcher/dispatcher';
import {EventEmitter} from 'events';
import moment from 'moment';
import shortId from 'shortid';

const CHANGE_EVENT = 'change';
let calendarEvents = new Map();
let idToken = null;

const create = (plant, plantedDate) => {
    const plantedDateMoment = moment.utc(plantedDate);
    if (!plantedDateMoment.isValid()) {
        throw new Error(`Invalid planted date ${plantedDate}`);
    }
    
    const id = shortId.generate();
    const growTime = moment.duration(plant.growTime);
    const readyDate = moment().
        utc(plantedDateMoment).
        add(growTime).
        toISOString();
    
    return calendarEvents.set(
        id,
        {
            id: id,
            plant: plant,
            plantedDate: plantedDateMoment.toISOString(),
            readyDate: readyDate,
{'fraction_non_alphanumeric': 0.11534276387377584, 'fraction_numerical': 0.0, 'mean_word_length': 2.8961864406779663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1557390', 'n_tokens_mistral': 512, 'n_tokens_neox': 519, 'n_words': 138}