Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ambitus

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ambitus

A calendar interval controller

  • 0.3.0
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Ambitus

NPM version Build Status Coverage Status Dependency Status

A stateful calendar control module providing intuitive range switching and navigation.

Ambitus can be used to control standard calendar UIs that expose day/week/month views with functions to navigate to the next and previous range and to return to today.

The aim is to provide a user experience that shows the expected range, no matter what date interval size the user navigates or switches to. When switching from a bigger interval to a smaller one, the first day of the bigger is chosen and the wanted range that includes it is returned. When switching from a smaller to a bigger range Ambitus tries to return to the previous selected one if there is a range overlap with the smaller one. The concept of 'today' is given special significance when switching interval size.

All dates returned by Ambitus are instances of moment.

All date ranges returned by Ambitus are instances of moment-range.

This gives you a very rich tool chain to work with the resulting ranges and dates.

Configuration

new Ambitus({
    // Give special significance to today
    ignoreToday: false,

    // Initial interval string
    interval: 'month', // ['day', 'week', 'month']

    // First day of week (TODO)
    // weekstart: 0,

    // Use UTC time (TODO)
    // utc: false,

    // Callback that is fired before the internal state changes
    // Return false to block the change
    onBeforeChange: function (newState, oldState) {},

    // Callback that is fired when the internal state changes
    onChange: function (newState, oldState) {}
});

Methods

Amitus.get(): Returns the current value

Amitus.interval(intervalString): Switches the interval. intervalString may be 'day', 'week' or 'month'

Amitus.next(): Switch to the next range.

Amitus.previous(): Switch to the previous range.

Amitus.today(): Jump directly to the range that contains todays date.

Amitus.go(date): Jump directly to an range including date. date may be any moment parseable value.

Dependencies

moment and moment-range. Both can be installed using bower. See test.html for example configuration.

Todo

  • Config: UTC dates
  • Config: First day of week

License

MIT

Keywords

FAQs

Package last updated on 09 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc