{"size": 602, "ext": "js", "max_stars_repo_path": "sanity/ariot-2018/schemas/types/timeRange.js", "max_stars_repo_name": "Itera/ariot2018", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sanity/ariot-2018/schemas/types/timeRange.js", "max_issues_repo_name": "Itera/ariot2018", "max_issues_repo_issues_event_min_datetime": "2018-03-15T15:04:10.000Z", "max_issues_repo_issues_event_max_datetime": "2018-03-15T16:02:28.000Z", "max_forks_repo_path": "sanity/ariot-2018/schemas/types/timeRange.js", "max_forks_repo_name": "Itera/ariot2018", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 18.2424242424, "max_line_length": 117, "alphanum_fraction": 0.476744186}
import format from "date-fns/format";

export default {
  name: 'timeRange',
  title: 'Time range',
  type: 'object',
  fields: [
    {
      name: 'from',
      title: 'From',
      type: 'datetime',
    },
    {
      name: 'to',
      title: 'To',
      type: 'datetime',
    },
  ],
  preview: {
    select: {
      from: 'from',
      to: 'to',
      type: '_type',
    },
    prepare(selection) {
      return {
        title: `From: ${format(selection.from, 'DD.MM.YY, HH:mm')} | To: ${format(selection.to, 'DD.MM.YY, HH:mm')}`,
        subtitle: `Type: ${selection.type}`,
      }
    }
  },
}
