npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

top-date-picker

v1.1.6

Published

A vue plugin to select jalali date and time

Downloads

7

Readme

Top-Date-Picker 📅⏰

Top-Date-Picker is a Vue.js plugin designed for selecting Jalali (Persian) date and time, optimized for mobile screen sizes.

Installation

Using npm

npm install top-date-picker --save

To configure moment to ignore loading locales:

// webpack.config.js:
module.exports.plugins = [
  //...
  new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
  //...
]

// vue.config.js:
module.exports = {
  //..
  configureWebpack: {
    plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)]
  },
  //...
}

Usage

In main.js:

// main.js
//...
import topDatePicker from 'top-date-picker';
Vue.component('date-picker', topDatePicker);
//...

Then used in component:

<date-picker v-model="date" />

Or in component:

<template>
  <div>
    <date-picker v-model="date"></date-picker>
  </div>
</template>
 
<script>
import topDatePicker from 'top-date-picker'
export default {
  data(){
    return {
      date: ''
    }
  },
  components: {
    datePicker: topDatePicker
  }
}
</script>

✨ Features

📝 Custom Input

If you want to use a custom input or custom element to trigger and show the datepicker, use the custom-input option.

custom-input="#inputId" 

Example :

<template>
  <div>
    <!-- Your input -->
    <input type="text" id="inputId">

    <date-picker
        v-model="date"
        custom-input="#inputId" 
    />
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      date: '2023-10-15',
    }
  },
}
</script>

🎉 Holidays

If you want to display holidays in the datepicker, use the holidays option.

:holidays="holidays"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      :holidays="holidays"
    />
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      date: '2023-10-15',
      holidays: {
        "1402/12/29": "روز ملی شدن صنعت نفت ایران",
      },
    }
  },
}
</script>

💸 Day Price

If you want to display price or text for each day, use the dayPrice option.

:dayPrice="priceList"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      :dayPrice="priceList"
    />
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      date: '2023-10-15',
      priceList : {
        "1402/06/30": "1500",
        "1402/07/30": "your text",
      } ,
    }
  },
}
</script>

⚡ Action Method

If you want to add an action when submitting a date in the datepicker, use the action option.

:action="yourMethod"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      :action="yourMethod"
    />
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      date: '2023-10-15',
      priceList : {
        "1402/06/30": "1500",
        "1402/07/30": "your text",
      } ,
    }
  },
  methods: {
    yourMethod() {
      console.log('run your method ... ')
    }
  }
}
</script>

🖥️ Desktop View

If you want to use this plugin on desktop, use the desktop-view option:

desktop-view="true"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      desktop-view="true"
    />
  </div>
</template>

🔍 Get Visible Value

If you want to get the visible value or know whether the dialog is open or closed, use the @getVisibleValue method.

@getVisibleValue="yourMethod"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      @getVisibleValue="yourMethod"
    />
  </div>
</template>

<script>
export default {
  data: function () {
    return {
      date: '2023-10-15',
      priceList : {
        "1402/06/30": "1500",
        "1402/07/30": "your text",
      } ,
    }
  },
  methods: {
    yourMethod(visibleValue){
      console.log("visibleValue => " , visibleValue)
    } ,
  }
}
</script>

🌑 Dark Mode

If you want to set Dark Mode, use the dark option:

:dark="true"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      :dark="true"
    />
  </div>
</template>

✅ Submit text

If you want to change the default submit text, use submitText.

submitText="Submit"

Example :

<template>
  <div>
    <date-picker
      v-model="date"
      submitText="Submit"
    />
  </div>
</template>

Built With

  • Vue.js - The Progressive JavaScript Framework.

  • Moment.js - Parse, validate, manipulate, and display dates and times in JavaScript.

  • moment-jalaali - A Jalaali (Jalali, Persian, Khorshidi, Shamsi) calendar system plugin for moment.js.

  • vue-persian-datetime-picker - A Vue plugin to select Jalali date and time.