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 |
---|---|---|
gap |
array
|
none
xxs
xs
sm
md
lg
xl
|
max_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
min_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
z_index |
array
|
1
2
3
4
5
6
7
8
9
10
|
number_spacing |
array
|
tabular
|
shadow |
array
|
none
deep
deeper
deepest
|
line_height |
array
|
tightest
tighter
tight
normal
loose
looser
loosest
|
display |
array
|
block
inline_block
inline
flex
inline_flex
none
grid
|
cursor |
array
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
crosshair
text
verticalText
alias
copy
move
noDrop
notAllowed
grab
grabbing
eResize
nResize
neResize
nwResize
sResize
seResize
swResize
wResize
ewResize
nsResize
neswResize
nwseResize
colResize
rowResize
allScroll
zoomIn
zoomOut
|
flex_direction |
array
|
row
column
rowReverse
columnReverse
|
flex_wrap |
array
|
wrap
nowrap
wrapReverse
|
justify_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
justify_self |
array
|
auto
start
end
center
stretch
|
align_items |
array
|
flexStart
flexEnd
start
end
center
baseline
stretch
|
align_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_self |
array
|
auto
start
end
center
stretch
baseline
|
flex |
array
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_grow |
array
|
1
0
|
flex_shrink |
array
|
1
0
|
order |
array
|
1
2
3
4
5
6
7
8
9
10
11
12
|
position |
array
|
relative
absolute
fixed
sticky
|
hover |
array
|
|
border_radius |
array
|
none
xs
sm
md
lg
xl
rounded
|
text_align |
array
|
start
end
left
right
center
justify
justify-all
match-parent
|
overflow |
array
|
visible
hidden
scroll
auto
|
truncate |
array
|
1
2
3
4
5
|
left |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
top |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
right |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
bottom |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
vertical_align |
array
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
min_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
max_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
overflow_x |
array
|
visible
hidden
scroll
auto
|
overflow_y |
array
|
visible
hidden
scroll
auto
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
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
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
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
|
classname |
string
|
|
column_gap |
string
|
|
row_gap |
string
|
|
group_hover |
boolean
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
html_options |
hashprop
|
|
children |
proc
|
|
style |
hashprop
|
Props | Type | Values | Default |
---|---|---|---|
dark |
boolean
|
false
|
|
text |
string
|
||
timestamp |
string
|
||
align |
enum
|
left
center
right
|
left
|
hide_updated |
boolean
|
false
|
|
show_current_year |
boolean
|
false
|
|
show_date |
boolean
|
true
|
|
show_time |
boolean
|
true
|
|
show_timezone |
boolean
|
false
|
|
show_user |
boolean
|
false
|
|
timezone |
string
|
America/New_York
|
|
unstyled |
boolean
|
false
|
|
variant |
enum
|
default
elapsed
updated
|
default
|