Giter VIP home page Giter VIP logo

smart_dates's Introduction

Smart Dates is a module about user interface, and making your Drupal
site more magical.

If you've ever had to create a lot of content with Dates included,
you'll have run into a standard frustrating user experience. From Date
and To Date are populated with some defaults, and after changing the
From Date, you have to go and also change the To Date. It's
aggravating, as we've come to expect our date fields to be smart, and
do expected smart things.

Smart Dates solves that, using datejs. It links From and To, Dates and
Times together with javascript. Maintaining intervals between them.

Algorithm

For the Time field, the logic is as follows: if From and To started
off the same (set by some default) make the To date 2hrs after the
From date (a setting for this default will be added later). After that
it does interval math between From and To, so if From is 6:30PM and To
is 8:00PM, and you change From to 7:00PM, To will now be 8:30PM.

For the Date field, intervals are always what's used. If you move From
ahead by a week, To date will shift the same amount.

This should work regardless of what input formatting you use for dates
and times, as the module translates between the date format you have
specified for the date field into the javascript formatter.

Installation and Configuration

Install the module. There is no configuration.

The module works by using hook_elements(), and hooking onto the
existing date fields. It will work in conjunction with Date Popup with
no issues.

Known Limitations

datejs is culture specific on how it parses dates (m/d/y vs. d/m/y,
for instance), and for now only the en-US version has been
integrated. If there is interest in other cultures being put in,
that's possible, but I'll wait until there is an open request so I've
got testers in other locales to make sure it *really* works.

Time fields aren't linked to Date fields. To Time will roll over past
midnight correctly, but the To Date doesn't shift forward when that
happens. This may be fixed in the future if people are actually
running into this on a regular basis.

Please file a tickets

This works in my setups extremely well, however everyone's setups are
different, so I really want folks to report issues in if they run into
them. I'll be happy to fix them.

smart_dates's People

Contributors

sdague avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.