Skip to content

Instantly share code, notes, and snippets.

@shimakyohsuke
Created February 10, 2017 08:03
Show Gist options
  • Save shimakyohsuke/5a984bf6aa228b0f696ed6b8b7940f12 to your computer and use it in GitHub Desktop.
Save shimakyohsuke/5a984bf6aa228b0f696ed6b8b7940f12 to your computer and use it in GitHub Desktop.
pug で年月日できる mixin
//- +year_month_day(ture || false, start_year, end_year)
mixin year_month_day(required, start_year, end_year)
select(name='year', required=required)
option(value='', selected='selected') -
- var y = start_year
while y <= end_year
option(value=y + '年')=y++ + '年'
select(name='month', required=required)
option(value='', selected='selected') -
- var m = 1
while m <= 12
option(value=m + '月')=m++ + '月'
select(name='day', required=required)
option(value='', selected='selected') -
- var d = 1
while d <= 31
option(value=d + '日')=d++ + '日'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment