In today's fast-paced digital world, selecting a date and time has become an integral part of many web applications. As developers, we strive to create intuitive and user-friendly interfaces that make it easy for our users to interact with our apps. This is where Century comes in – a powerful date and time picker that provides unparalleled flexibility and customization options.
Overview
Century is a comprehensive JavaScript library that allows you to create custom date and time pickers for your web applications. With its robust feature set, you can easily add sophisticated date and time selection capabilities to your application, without the need for extensive coding or debugging.
Defaults
When you initialize Century, you can set various default values to tailor the picker to your specific needs. These defaults include:
previousDecade
,previousMonth
,previousYear
: Allows users to navigate through dates using these options.selectDate
,selectDecade
,selectMonth
,selectTime
,selectYear
: Enables users to select specific dates or times.startOfTheWeek
: Specifies the first day of the week (0 for Sunday, 1 for Monday, and so on).today
: Allows users to quickly jump to the current date and time.toggleMeridiem
: Toggles between AM/PM and 24-hour clock formats.
Stepping
Century's stepping feature allows you to control how much the minutes are changed by. This also updates the minute selection grid to step by the specified amount. You can set this default value using the stepping
option, which accepts a number (default is 1).
Use Current
By setting useCurrent
to true
(default), Century uses the current date and time as the default value when the picker is opened.
Default Date
You can also specify a custom default date and time using the defaultDate
option, which accepts a string, Date, or DateTime object. This overrides the useCurrent
setting.
Keep Invalid
If you set keepInvalid
to true
, Century allows users to select dates that are invalid according to your application's rules (e.g., dates past the maximum allowed date).
Debug
The debug
option enables debugging mode, which keeps the picker open during events where it would normally close. This is useful when trying to debug rules or CSS changes.
Allow Input Toggle
When allowInputToggle
is set to true
, Century shows the picker on textbox focus.
View Date
You can set a custom view date for the picker using the viewDate
option, which accepts a string, Date, or DateTime object. This does not affect the selected dates.
Multiple Dates
Century's multipleDates
feature allows users to select multiple dates. You can enable this by setting the option to true
.
Multiple Dates Separator
When multipleDates
is enabled, you can specify the separator used to separate the selected dates using the multipleDatesSeparator
option (default is a semicolon ;
).
Prompt Time On Date Change
If you set promptTimeOnDateChange
to true
, Century will automatically display the clock view after a specified transition delay when a user selects a date.
Prompt Time On Date Change Transition Delay
The transition delay for the prompt time on date change can be set using the promptTimeOnDateChangeTransitionDelay
option (default is 200 milliseconds).
Meta
Century provides a meta object to store extra information about the picker. You can use this to store database format strings or other relevant data.
Container
Finally, you can specify an alternative container for the widget using the container
option, which accepts an HTML element., Century offers an impressive array of features and customization options, making it an ideal choice for modern web applications that require sophisticated date and time selection capabilities. With its robust default settings and flexibility, Century simplifies the process of building custom date and time pickers, allowing you to focus on delivering exceptional user experiences.