<template>
  <h2 class="tool-title">Explain crontab</h2>
  <hr class="mt-5 mb-5">

  <div class="input-group">
    <label for="data">Data</label>
    <input id="data" class="input" v-model="toolData.data" placeholder="* * * * *" type="text">
  </div>

  <hr class="mt-5 mb-5">

  <div class="input-group">
    <label for="result">Result</label>
    <textarea id="result" v-model="toolResult"></textarea>
  </div>
</template>

<script>
import cronstrue from 'cronstrue';
import { unproxy } from "@/utils/unproxy";

export default {
  data() {
    return {
      toolData: {
        data: '* * * * *',
      },
    };
  },
  computed: {
    toolResult() {
      try {
        return cronstrue.toString(this.toolData.data, {
          use24HourTimeFormat: true,
          verbose: true,
        });
      } catch (e) {
        return 'invalid syntax';
      }
    },
  },
}
</script>

<style lang="scss">

</style>