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

european-date-text-field

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

european-date-text-field

  • 0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

EUROPEAN DATE TEXT FIELD

This is a small gem/plugin for when you want to use a textfield to enter a European formatted date like DD/MM/YYYY, and validate to this format.

With this gem/plugin you can enter a european formatted date into your text_field.

When a correctly formatted date is passed it will be converted to a Date object and stored in the database as a date-field.

Otherwise the wrong value will be shown in the field an the database will contain nil.

SUPPORTED FORMATS

  • DD/MM/Y
  • DD/MM/YYYY
  • D/M/Y
  • DD/M/YYYY

HOWTO

Install the plugin into your Rails 3 application like this:

rails plugin install http://github.com/fousa/european-date-text-field.git

Next you should define the columns that need time conversion in your model object:

class Person < ActiveRecord::Base
  european_date :birth_date
end

Then you have to change the name of your attributes in the form:

<%= f.text_field :european_birth_date %>

BE AWARE: You must add the european_ prefix at the beginning of your column names in order for the gem/plugin to work!

VALIDATIONS

You can also use the supplied validator like this:

validates :european_birth_date, :european_date => true

Now the birth_date will be validated according to the DD/MM/Y ,DD/MM/YYYY, D/M/Y or DD/M/YYYY formats.

Make sure you use the column name with the european_ prefix, because it's this field we want to validate and not the database column!

QUESTIONS

Just ask here on Github!

FAQs

Package last updated on 30 Mar 2010

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