This low profile kit displays time. Elapsed, current, future, or otherwise.
By default, the timestamp kit will display the date and time as shown here. If the date is NOT within the current year, the year will also be shown while dates in the current year will not show the year.
The showDate/show_date prop is set to true by default but can be set to false to hide the date.
The showTime/show_time prop is set to true by default but can be set to false to hide the time.
Use the showCurrentYear/show_current_year prop to show the year even if it is the current year. This is set to false by default.
The showTimezone/show_timezone prop can be used to show the timezone as well. This is set to false by default. NOTE: This prop must be used in conjunction with the timezone prop to specify which timezone to display.
<%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_date: false, show_timezone: true, timezone: "America/New_York", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_timezone: true, timezone: "America/New_York", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now + 4.years, show_timezone: true, timezone: "America/New_York", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 1.year, show_timezone: true, timezone: "America/New_York", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_date: false, show_timezone: true, timezone: "Asia/Hong_Kong", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_timezone: true, timezone: "Asia/Hong_Kong", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now + 4.years, show_timezone: true, timezone: "Asia/Hong_Kong", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 1.year, show_timezone: true, timezone: "Asia/Hong_Kong", }) %> <br>
The align prop can be used to set alignment. This prop is set to 'left' by default.
<%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_date: false, align: "left" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, align: "left" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now + 4.years, align: "left" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 1.year, align: "left" }) %> <br><br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, show_date: false, align: "center" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, align: "center" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now + 4.years, align: "center" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 1.year, align: "center" }) %> <br><br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, align: "right" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, align: "right" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now + 4.years, align: "right" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 1.year, align: "right" }) %>
Use variant elapsed to show time ago. This variant can be customized in several ways:
Use the optional showUser/show_user prop to show user as part of the text. When showing the user, pass in the user name using the text prop as shown. showUser/show_user is set to false by default.
Use the optional hideUpdated/hide_updated prop to hide the 'Last updated' text if needed.
<%= pb_rails("timestamp", props: { timestamp: DateTime.now, variant: "elapsed", show_user: true, text: "Maricris Nonato" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 3.months, variant: "elapsed", }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now - 320.days, variant: "elapsed", hide_updated: true }) %>
Use variant updated to show last updated at timestamp.
This variant can be customized using the optional showUser/show_user prop to show user as part of the text. When showing the user, pass in the user name using the text prop as shown.
showUser/show_user is set to false by default.
The updated variant can also be used in conjunction with the showCurrentYear/show_current_year prop to show the year even if it is the current year.
The updated variant can also be used in conjunction with the showDate/show_date prop. This prop is set to true by default but can be set to false to hide the date.
The updated variant can also be used in conjunction with the showTime/show_time prop. This prop is set to true by default but can be set to false to hide the time. This can also be used in conjunction with showCurrentYear/show_current_year to show the year even if it is the current year.
<%= pb_rails("timestamp", props: { timestamp: DateTime.now, variant: "updated", show_user: true, show_time: false, text: "Maricris Nonato" }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, variant: "updated", show_user: false, show_time: false }) %> <br> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, variant: "updated", show_current_year: true, show_user: false, show_time: false }) %>
For alternative typography styles, you can pass a boolean prop called unstyled to the Timestamp kit and wrap it in any of our typography kits (Title, Body, etc.). This will allow the Timestamp kit to inherit any of our typography styles.
<%= pb_rails("caption", props: { size: "xs", text: "Basic unstyled example" }) %> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, unstyled: true, }) %> <br /> <%= pb_rails("caption", props: { size: "xs", text: "Example with wrapping typography kit" }) %> <%= pb_rails("title", props: { size: 1 }) do %> <%= pb_rails("timestamp", props: { timestamp: DateTime.now, unstyled: true, }) %> <% end %>
Leave the text style as is. Don’t use timestamps to display important or sensitive time information.
| Props | Type | Values |
|---|---|---|
align_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_items |
enum | responsive
|
start
end
center
|
border_radius |
enum
|
none
xs
sm
md
lg
xl
rounded
|
cursor |
enum
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
|
dark |
boolean
|
true
false
|
flex |
enum | responsive
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_direction |
enum | responsive
|
row
column
rowReverse
columnReverse
|
flex_wrap |
enum | responsive
|
wrap
nowrap
wrapReverse
|
justify_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
line_height |
enum
|
loosest
looser
loose
normal
tight
tighter
tightest
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
width |
string
|
|
min_width |
string
|
|
max_width |
string
|
|
gap |
string | responsive
|
|
column_gap |
string | responsive
|
|
row_gap |
string | responsive
|
|
number_spacing |
enum
|
tabular
|
order |
enum | responsive
|
none
first
1
2
3
4
5
6
7
8
9
10
11
12
|
overflow_x |
enum
|
scroll
visible
hidden
auto
|
overflow_y |
enum
|
scroll
visible
hidden
auto
|
overflow |
enum
|
scroll
visible
hidden
auto
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
position |
enum
|
relative
absolute
fixed
sticky
static
|
shadow |
enum
|
none
deep
deeper
deepest
|
text_align |
enum | responsive
|
start
end
left
right
center
justify
justifyAll
matchParent
|
truncate |
enum
|
none
1
2
3
4
5
|
vertical_align |
enum | responsive
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
z_index |
enum | responsive
|
1
2
3
4
5
6
7
8
9
10
max
|
top |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
inset |
boolean
|
true
false
|
right |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
bottom |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
left |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
height |
string
|
|
max_height |
string
|
|
min_height |
string
|
|
hover |
object
|
|
group_hover |
boolean
|
true
false
|
| Props | Type | Values | Default |
|---|---|---|---|
align |
enum
|
left
center
right
|
left
|
text |
string
|
||
timestamp |
date | string
|
||
timezone |
string
|
America/New_York
|
|
show_current_year |
boolean
|
true
false
|
false
|
show_date |
boolean
|
true
false
|
true
|
show_user |
boolean
|
true
false
|
false
|
hide_updated |
boolean
|
true
false
|
false
|
show_time |
boolean
|
true
false
|
true
|
show_timezone |
boolean
|
true
false
|
false
|
unstyled |
boolean
|
true
false
|
false
|
variant |
enum
|
default
elapsed
updated
|
default
|