Advertisement
fweng322

Diff of date format for Indico source

Dec 14th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.63 KB | None | 0 0
  1. diff --git a/indico/modules/categories/client/js/calendar.js b/indico/modules/categories/client/js/calendar.js
  2. index 5533706954..351548120b 100644
  3. --- a/indico/modules/categories/client/js/calendar.js
  4. +++ b/indico/modules/categories/client/js/calendar.js
  5. @@ -47,7 +47,9 @@ import 'fullcalendar/dist/fullcalendar.css';
  6. });
  7. ajaxDialog({
  8. dialogClasses: 'all-events-dialog',
  9. - title: $T.gettext('Events happening on {0}').format(cellInfo.date.format('MMMM Do YYYY')),
  10. +// Franklin.20191214
  11. +// title: $T.gettext('Events happening on {0}').format(cellInfo.date.format('MMMM Do YYYY')),
  12. + title: $T.gettext('Events happening on {0}').format(cellInfo.date.format('YYYYMMMM DD ?')),
  13. content,
  14. });
  15. },
  16. diff --git a/indico/modules/categories/controllers/display.py b/indico/modules/categories/controllers/display.py
  17. index 7f8344f4de..667682ac54 100644
  18. --- a/indico/modules/categories/controllers/display.py
  19. +++ b/indico/modules/categories/controllers/display.py
  20. @@ -244,7 +244,9 @@ class RHDisplayCategoryEventsBase(RHDisplayCategoryBase):
  21. self.now = now_utc(exact=False).astimezone(self.category.display_tzinfo)
  22.  
  23. def format_event_date(self, event):
  24. - day_month = 'dd MMM'
  25. + # Franklin.20191214
  26. + #day_month = 'dd MMM'
  27. + day_month = 'MMMdd?'
  28. tzinfo = self.category.display_tzinfo
  29. start_dt = event.start_dt.astimezone(tzinfo)
  30. end_dt = event.end_dt.astimezone(tzinfo)
  31. @@ -260,7 +262,9 @@ class RHDisplayCategoryEventsBase(RHDisplayCategoryBase):
  32. def group_by_month(self, events):
  33. def _format_tuple(x):
  34. (year, month), events = x
  35. - return {'name': format_date(date(year, month, 1), format='MMMM yyyy'),
  36. + # Franklin.20191214
  37. + #return {'name': format_date(date(year, month, 1), format='MMMM yyyy'),
  38. + return {'name': format_date(date(year, month, 1), format='yyyy MMMM'),
  39. 'events': list(events),
  40. 'is_current': year == self.now.year and month == self.now.month}
  41.  
  42. diff --git a/indico/modules/categories/templates/display/calendar.html b/indico/modules/categories/templates/display/calendar.html
  43. index 4907dce689..81707939f3 100644
  44. --- a/indico/modules/categories/templates/display/calendar.html
  45. +++ b/indico/modules/categories/templates/display/calendar.html
  46. @@ -16,7 +16,9 @@
  47. return [date.getDate() == 1, ''];
  48. },
  49. onSelect: function(date) {
  50. - $('#event-calendar').fullCalendar('gotoDate', new moment(date, 'DD/MM/YYYY'));
  51. +// Franklin.20191214
  52. +// $('#event-calendar').fullCalendar('gotoDate', new moment(date, 'DD/MM/YYYY'));
  53. + $('#event-calendar').fullCalendar('gotoDate', new moment(date, 'YYYY/MM/DD'));
  54. }
  55. });
  56. })();
  57. diff --git a/indico/modules/categories/templates/display/overview/week.html b/indico/modules/categories/templates/display/overview/week.html
  58. index 5d0f59495e..346b370eb6 100644
  59. --- a/indico/modules/categories/templates/display/overview/week.html
  60. +++ b/indico/modules/categories/templates/display/overview/week.html
  61. @@ -24,7 +24,9 @@
  62. <tr>
  63. {% for day, events in events_by_day %}
  64. <th>
  65. - {{ day|format_date(format='EEE d MMM') }}
  66. + <!-- Franklin.20191214 -->
  67. + <!-- {{ day|format_date(format='EEE d MMM') }} -->
  68. + {{ day|format_date(format='MMMd??EEE?') }}
  69. </th>
  70. {% endfor %}
  71. </tr>
  72. diff --git a/indico/modules/designer/placeholders.py b/indico/modules/designer/placeholders.py
  73. index 33902fd2d1..88d9908401 100644
  74. --- a/indico/modules/designer/placeholders.py
  75. +++ b/indico/modules/designer/placeholders.py
  76. @@ -85,7 +85,9 @@ class EventDatesPlaceholder(DesignerPlaceholder):
  77. interval = to_unicode(format_datetime(start_dt))
  78. elif start_dt.date().replace(day=1) == end_dt.date().replace(day=1):
  79. interval = "{} - {} {}".format(start_dt.day, end_dt.day,
  80. - to_unicode(format_date(start_dt, format='MMMM yyyy')))
  81. + # Franklin.20191214
  82. + #to_unicode(format_date(start_dt, format='MMMM yyyy')))
  83. + to_unicode(format_date(start_dt, format='yyyy MMMM')))
  84. return interval
  85.  
  86.  
  87. diff --git a/indico/modules/events/client/js/creation.js b/indico/modules/events/client/js/creation.js
  88. index 7525de71b7..0c68a9dc63 100644
  89. --- a/indico/modules/events/client/js/creation.js
  90. +++ b/indico/modules/events/client/js/creation.js
  91. @@ -98,8 +98,11 @@ import {camelizeKeys} from 'indico/utils/case';
  92. if (occurrences && occurrences.length === 1) {
  93. setLectureTimes(occurrences[0]);
  94. } else {
  95. - startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  96. - endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  97. + // Franklin.20191215
  98. + //startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  99. + //endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  100. + startDt = moment(`${startDate} ${startTime}`, 'YYYY/MM/DD HH:mm');
  101. + endDt = moment(`${endDate} ${endTime}`, 'YYYY/MM/DD HH:mm');
  102. }
  103. }
  104.  
  105. @@ -222,11 +225,16 @@ import {camelizeKeys} from 'indico/utils/case';
  106. const startTime = $('#event-creation-start_dt-time').val();
  107. const endDate = $('#event-creation-end_dt-date').val();
  108. const endTime = $('#event-creation-end_dt-time').val();
  109. - startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  110. - endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  111. + // Franklin.20191215
  112. + //startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  113. + //endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  114. + startDt = moment(`${startDate} ${startTime}`, 'YYYY/MM/DD HH:mm');
  115. + endDt = moment(`${endDate} ${endTime}`, 'YYYY/MM/DD HH:mm');
  116. // workaround for automatic end date update if start date is after end date
  117. if (endDt.isBefore(startDt)) {
  118. - endDt = moment(`${startDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  119. + // Franklin.20191215
  120. + //endDt = moment(`${startDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  121. + endDt = moment(`${startDate} ${endTime}`, 'YYYY/MM/DD HH:mm');
  122. }
  123. updateAvailability();
  124. });
  125. @@ -234,21 +242,27 @@ import {camelizeKeys} from 'indico/utils/case';
  126. $('#event-creation-start_dt-time').on('change', function() {
  127. const startDate = $('#event-creation-start_dt-date').val();
  128. const startTime = $('#event-creation-start_dt-time').val();
  129. - startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  130. + // Franklin.20191215
  131. + //startDt = moment(`${startDate} ${startTime}`, 'DD/MM/YYYY HH:mm');
  132. + startDt = moment(`${startDate} ${startTime}`, 'YYYY/MM/DD HH:mm');
  133. updateAvailability();
  134. });
  135.  
  136. $('#event-creation-end_dt-date').on('change', function() {
  137. const endDate = $(this).val();
  138. const endTime = $('#event-creation-end_dt-time').val();
  139. - endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  140. + // Franklin.20191215
  141. + //endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  142. + endDt = moment(`${endDate} ${endTime}`, 'YYYY/MM/DD HH:mm');
  143. updateAvailability();
  144. });
  145.  
  146. $('#event-creation-end_dt-time').on('change', function() {
  147. const endDate = $('#event-creation-end_dt-date').val();
  148. const endTime = $(this).val();
  149. - endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  150. + // Franklin.20191215
  151. + //endDt = moment(`${endDate} ${endTime}`, 'DD/MM/YYYY HH:mm');
  152. + endDt = moment(`${endDate} ${endTime}`, 'YYYY/MM/DD HH:mm');
  153. updateAvailability();
  154. });
  155.  
  156. diff --git a/indico/modules/events/contributions/client/js/index.jsx b/indico/modules/events/contributions/client/js/index.jsx
  157. index a908692371..edd541b40a 100644
  158. --- a/indico/modules/events/contributions/client/js/index.jsx
  159. +++ b/indico/modules/events/contributions/client/js/index.jsx
  160. @@ -162,7 +162,9 @@ import {indicoAxios, handleAxiosError} from 'indico/utils/axios';
  161. oldLabelHtml
  162. .filter('.label')
  163. // eslint-disable-next-line prefer-template
  164. - .text(' ' + moment.utc(data.start_dt).format('DD/MM/YYYY HH:mm'));
  165. + // Franklin.20191215
  166. + //.text(' ' + moment.utc(data.start_dt).format('DD/MM/YYYY HH:mm'));
  167. + .text(' ' + moment.utc(data.start_dt).format('YYYY/MM/DD HH:mm'));
  168. startDateCol.html(oldLabelHtml);
  169. $this.itempicker('selectItem', oldSession ? oldSession.id : null);
  170. });
  171. diff --git a/indico/modules/events/management/templates/_management_frame.html b/indico/modules/events/management/templates/_management_frame.html
  172. index de0ce5184f..d75fcae404 100644
  173. --- a/indico/modules/events/management/templates/_management_frame.html
  174. +++ b/indico/modules/events/management/templates/_management_frame.html
  175. @@ -23,10 +23,10 @@
  176. {% endif %}
  177. {%- endmacro -%}
  178.  
  179. -
  180. +<!-- Franklin.20191215: change from 'd MMM' to 'MMMd?' -->
  181. {% macro render_event_management_header_right(event, event_types) %}
  182. - {% set start_date = event.start_dt | format_date('d MMM', timezone=event.tzinfo) %}
  183. - {% set end_date = event.end_dt | format_date('d MMM', timezone=event.tzinfo) %}
  184. + {% set start_date = event.start_dt | format_date('MMMd?', timezone=event.tzinfo) %}
  185. + {% set end_date = event.end_dt | format_date('MMMd?', timezone=event.tzinfo) %}
  186.  
  187. <div class="banner full-width">
  188. <div class="title">
  189. diff --git a/indico/modules/events/operations.py b/indico/modules/events/operations.py
  190. index bf9b0903dd..d76bfd9301 100644
  191. --- a/indico/modules/events/operations.py
  192. +++ b/indico/modules/events/operations.py
  193. @@ -94,7 +94,9 @@ def create_event(category, event_type, data, add_creator_as_manager=True, featur
  194. if booking:
  195. logger.info('Booking %r created for event %r', booking, event)
  196. log_data = {'Room': booking.room.full_name,
  197. - 'Date': booking.start_dt.strftime('%d/%m/%Y'),
  198. +# Franklin.20191214
  199. +# 'Date': booking.start_dt.strftime('%d/%m/%Y'),
  200. + 'Date': booking.start_dt.strftime('%Y/%m/%d'),
  201. 'Times': '%s - %s' % (booking.start_dt.strftime('%H:%M'), booking.end_dt.strftime('%H:%M'))}
  202. event.log(EventLogRealm.event, EventLogKind.positive, 'Event', 'Room booked for the event',
  203. session.user, data=log_data)
  204. diff --git a/indico/modules/events/registration/client/js/form/field.js b/indico/modules/events/registration/client/js/form/field.js
  205. index a6349bc4d8..828c91804f 100644
  206. --- a/indico/modules/events/registration/client/js/form/field.js
  207. +++ b/indico/modules/events/registration/client/js/form/field.js
  208. @@ -877,14 +877,20 @@ ndRegForm.directive('ndAccommodationField', function(url) {
  209. controller: function($scope) {
  210. $scope.tplInput = url.tpl('fields/accommodation.tpl.html');
  211. $scope.areArrivalDatesValid = function(data) {
  212. - return moment(data['arrivalDateTo'], 'DD/MM/YYYY').isSameOrAfter(
  213. - moment(data['arrivalDateFrom'], 'DD/MM/YYYY')
  214. + // Franklin.20191215
  215. + //return moment(data['arrivalDateTo'], 'DD/MM/YYYY').isSameOrAfter(
  216. + // moment(data['arrivalDateFrom'], 'DD/MM/YYYY')
  217. + return moment(data['arrivalDateTo'], 'YYYY/MM/DD').isSameOrAfter(
  218. + moment(data['arrivalDateFrom'], 'YYYY/MM/DD')
  219. );
  220. };
  221.  
  222. $scope.areDepartureDatesValid = function(data) {
  223. - return moment(data['departureDateTo'], 'DD/MM/YYYY').isSameOrAfter(
  224. - moment(data['departureDateFrom'], 'DD/MM/YYYY')
  225. + // Franklin.20191215
  226. + //return moment(data['departureDateTo'], 'DD/MM/YYYY').isSameOrAfter(
  227. + // moment(data['departureDateFrom'], 'DD/MM/YYYY')
  228. + return moment(data['departureDateTo'], 'YYYY/MM/DD').isSameOrAfter(
  229. + moment(data['departureDateFrom'], 'YYYY/MM/DD')
  230. );
  231. };
  232.  
  233. @@ -951,7 +957,9 @@ ndRegForm.directive('ndAccommodationField', function(url) {
  234.  
  235. function formatDate(date) {
  236. if (date) {
  237. - return moment(date).format('DD/MM/YYYY');
  238. + // Franklin.20191215
  239. + //return moment(date).format('DD/MM/YYYY');
  240. + return moment(date).format('YYYY/MM/DD');
  241. }
  242. }
  243.  
  244. @@ -963,19 +971,27 @@ ndRegForm.directive('ndAccommodationField', function(url) {
  245. formatDate(field.arrivalDateFrom) ||
  246. moment(eventStartDate)
  247. .subtract(2, 'days')
  248. - .format('DD/MM/YYYY');
  249. + //Franklin.20191215
  250. + //.format('DD/MM/YYYY');
  251. + .format('YYYY/MM/DD');
  252. formData.arrivalDateTo =
  253. - formatDate(field.arrivalDateTo) || moment(eventEndDate).format('DD/MM/YYYY');
  254. + // Franklin.20191215
  255. + //formatDate(field.arrivalDateTo) || moment(eventEndDate).format('DD/MM/YYYY');
  256. + formatDate(field.arrivalDateTo) || moment(eventEndDate).format('YYYY/MM/DD');
  257. formData.departureDateFrom =
  258. formatDate(field.departureDateFrom) ||
  259. moment(eventStartDate)
  260. .add(1, 'days')
  261. - .format('DD/MM/YYYY');
  262. + //Franklin.20191215
  263. + //.format('DD/MM/YYYY');
  264. + .format('YYYY/MM/DD');
  265. formData.departureDateTo =
  266. formatDate(field.departureDateTo) ||
  267. moment(eventEndDate)
  268. .add(3, 'days')
  269. - .format('DD/MM/YYYY');
  270. + //Franklin.20191215
  271. + //.format('DD/MM/YYYY');
  272. + .format('YYYY/MM/DD');
  273. _.each(field.choices, function(item, ind) {
  274. formData.choices[ind] = angular.copy(item);
  275. });
  276. diff --git a/indico/modules/events/registration/client/js/form/form.js b/indico/modules/events/registration/client/js/form/form.js
  277. index 59d2bb9fe2..5a4de78779 100644
  278. --- a/indico/modules/events/registration/client/js/form/form.js
  279. +++ b/indico/modules/events/registration/client/js/form/form.js
  280. @@ -43,6 +43,8 @@ ndRegForm.value('fieldDefaults', {
  281. defaultPrice: 0,
  282. defaultMinValue: 0,
  283. defaultPlacesLimit: 0,
  284. + //Franklin.20191214
  285. + //defaultDateFormat: '%d/%m/%Y',
  286. defaultDateFormat: '%d/%m/%Y',
  287. defaultPhoneSize: 30,
  288. });
  289. diff --git a/indico/modules/events/registration/client/js/form/section.js b/indico/modules/events/registration/client/js/form/section.js
  290. index 632f62d513..80ed4f4ae6 100644
  291. --- a/indico/modules/events/registration/client/js/form/section.js
  292. +++ b/indico/modules/events/registration/client/js/form/section.js
  293. @@ -308,10 +308,13 @@ ndRegForm.directive('ndSectionDialog', function(url) {
  294. ndRegForm.filter('possibleDeparture', function() {
  295. return function(departure, scope) {
  296. if (scope.accommodation.arrival !== undefined) {
  297. - var arrival = moment(scope.accommodation.arrival, 'DD/MM/YYY');
  298. + // Franklin.20191214
  299. + //var arrival = moment(scope.accommodation.arrival, 'DD/MM/YYY');
  300. + var arrival = moment(scope.accommodation.arrival, 'YYY/MM/DD');
  301. var possibleDepartures = {};
  302. _.each(scope.section.departureDates, function(value, key) {
  303. - var departure = moment(key, 'DD/MM/YYY');
  304. + //var departure = moment(key, 'DD/MM/YYY');
  305. + var departure = moment(key, 'YYY/MM/DD');
  306. if (arrival.isBefore(departure) || arrival.isSame(departure)) {
  307. possibleDepartures[key] = value;
  308. }
  309. diff --git a/indico/modules/events/registration/fields/choices.py b/indico/modules/events/registration/fields/choices.py
  310. index 601777b85b..4e1d225911 100644
  311. --- a/indico/modules/events/registration/fields/choices.py
  312. +++ b/indico/modules/events/registration/fields/choices.py
  313. @@ -296,7 +296,9 @@ class MultiChoiceField(ChoiceBaseField):
  314.  
  315.  
  316. def _to_machine_date(date):
  317. - return datetime.strptime(date, '%d/%m/%Y').strftime('%Y-%m-%d')
  318. + #Franklin.20191214
  319. + #return datetime.strptime(date, '%d/%m/%Y').strftime('%Y-%m-%d')
  320. + return datetime.strptime(date, '%Y/%m/%d').strftime('%Y-%m-%d')
  321.  
  322.  
  323. def _to_date(date):
  324. diff --git a/indico/modules/events/templates/display/conference/base.html b/indico/modules/events/templates/display/conference/base.html
  325. index 4fe044af4b..f8d7e920dc 100644
  326. --- a/indico/modules/events/templates/display/conference/base.html
  327. +++ b/indico/modules/events/templates/display/conference/base.html
  328. @@ -3,13 +3,14 @@
  329. {% from 'events/display/_event_header_message.html' import render_event_header_msg %}
  330. {% from 'events/layout/_menu.html' import menu_entry_display %}
  331.  
  332. +<!-- Franklin.20191215 change from 'MMMM yyyy' to 'yyyy MMMM' -->
  333. {%- macro _format_event_date(event) -%}
  334. {% set start_dt = event.start_dt_display.astimezone(event.display_tzinfo) %}
  335. {% set end_dt = event.end_dt_display.astimezone(event.display_tzinfo) %}
  336. {% if start_dt.date() == end_dt.date() %}
  337. {{ start_dt | format_date('long') }}
  338. {% elif start_dt.year == end_dt.year and start_dt.month == end_dt.month %}
  339. - {{ start_dt.day }}-{{ end_dt.day }} {{ start_dt | format_date('MMMM yyyy') }}
  340. + {{ start_dt.day }}-{{ end_dt.day }} {{ start_dt | format_date('yyyy MMMM') }}
  341. {% else %}
  342. {% trans start=start_dt|format_date('long'), end=end_dt|format_date('long') -%}
  343. {{ start }} to {{ end }}
  344. diff --git a/indico/modules/events/timetable/templates/display/indico/meeting.html b/indico/modules/events/timetable/templates/display/indico/meeting.html
  345. index 08fd351640..fa47efc484 100644
  346. --- a/indico/modules/events/timetable/templates/display/indico/meeting.html
  347. +++ b/indico/modules/events/timetable/templates/display/indico/meeting.html
  348. @@ -23,7 +23,9 @@
  349. {% block day_header scoped %}
  350. <div class="day-header" style="width: 100%;">
  351. <div class="day-title" data-anchor="{{ anchor }}">
  352. - {{ item.start_dt | format_date(format='EEEE, d MMMM', timezone=timezone) }}
  353. + <!-- Franklin.20191214 -->
  354. + <!-- {{ item.start_dt | format_date(format='EEEE, d MMMM', timezone=timezone) }} -->
  355. + {{ item.start_dt | format_date(format='MMMMd??EEEE?', timezone=timezone) }}
  356. </div>
  357. {% if days %}
  358. <a class="js-go-to-day icon-calendar arrow js-dropdown" data-toggle="dropdown"></a>
  359. @@ -31,7 +33,9 @@
  360. {% for day, _ in days %}
  361. <li>
  362. <a href="#day-{{ day.isoformat() }}">
  363. - {{ day | format_date(format='EEE, d MMM', timezone=timezone) }}
  364. + <!-- Franklin.20191214 -->
  365. + <!-- {{ day | format_date(format='EEE, d MMM', timezone=timezone) }} -->
  366. + {{ day | format_date(format='MMMd??EEE?', timezone=timezone) }}
  367. </a>
  368. </li>
  369. {% endfor %}
  370. diff --git a/indico/modules/events/timetable/templates/move_entry.html b/indico/modules/events/timetable/templates/move_entry.html
  371. index 1258cb5e72..c66e2a25c2 100644
  372. --- a/indico/modules/events/timetable/templates/move_entry.html
  373. +++ b/indico/modules/events/timetable/templates/move_entry.html
  374. @@ -9,7 +9,9 @@
  375. {% for day, entries in top_level_entries.iteritems() | sort %}
  376. <button class="i-button big day {%- if day == current_day %} highlight{% endif %}"
  377. data-day="{{ day }}">
  378. - {{- day | format_date(format='EEE, d MMM') -}}
  379. + <!-- Franklin.20191214 -->
  380. + <!-- {{- day | format_date(format='EEE, d MMM') -}} -->
  381. + {{- day | format_date(format='MMMd??EEE?') -}}
  382. </button>
  383. {% endfor %}
  384. </div>
  385. diff --git a/indico/modules/rb/client/js/common/timeline/WeeklyTimelineContent.jsx b/indico/modules/rb/client/js/common/timeline/WeeklyTimelineContent.jsx
  386. index 66cad40575..929d1260d5 100644
  387. --- a/indico/modules/rb/client/js/common/timeline/WeeklyTimelineContent.jsx
  388. +++ b/indico/modules/rb/client/js/common/timeline/WeeklyTimelineContent.jsx
  389. @@ -109,6 +109,7 @@ export default class WeeklyTimelineContent extends DailyTimelineContent {
  390. renderHeader() {
  391. const {longLabel, selectable, setDate, setMode} = this.props;
  392. const labelWidth = longLabel ? 200 : 150;
  393. + // Franklin.20191214
  394. return (
  395. <div
  396. styleName="baseStyle.timeline-header"
  397. @@ -128,7 +129,7 @@ export default class WeeklyTimelineContent extends DailyTimelineContent {
  398. setMode('days');
  399. }}
  400. >
  401. - {toMoment(dt, 'YYYY-MM-DD').format('ddd D MMM')}
  402. + {toMoment(dt, 'YYYY-MM-DD').format('MMM D ?(ddd)')}
  403. </span>
  404. </div>
  405. ))}
  406. diff --git a/indico/modules/rb/templates/emails/reservations/creation_email_to_user.txt b/indico/modules/rb/templates/emails/reservations/creation_email_to_user.txt
  407. index ecc43baf80..da957d53b0 100644
  408. --- a/indico/modules/rb/templates/emails/reservations/creation_email_to_user.txt
  409. +++ b/indico/modules/rb/templates/emails/reservations/creation_email_to_user.txt
  410. @@ -3,12 +3,13 @@
  411.  
  412. {% block body -%}
  413. {%- block booking_details -%}
  414. +
  415. The conference room {{ reservation.room.full_name }}
  416. has been {% block prebooked_prefix %}{% endblock %}booked for {{ reservation.booked_for_name }}
  417. {% if reservation.repeat_frequency == RepeatFrequency.NEVER -%}
  418. - on {{ reservation.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }} from {{ reservation.start_dt | format_time(locale='en_GB') }} to {{ reservation.end_dt | format_time(locale='en_GB') }}.
  419. + on {{ reservation.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }} from {{ reservation.start_dt | format_time(locale='zh_TW') }} to {{ reservation.end_dt | format_time(locale='zh_TW') }}.
  420. {%- else -%}
  421. - {{ RepeatMapping.get_message(reservation.repeat_frequency, reservation.repeat_interval) }} from {{ reservation.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }} to {{ reservation.end_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }} between {{ reservation.start_dt | format_time(locale='en_GB') }} and {{ reservation.end_dt | format_time(locale='en_GB') }}.
  422. + {{ RepeatMapping.get_message(reservation.repeat_frequency, reservation.repeat_interval) }} from {{ reservation.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }} to {{ reservation.end_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }} between {{ reservation.start_dt | format_time(locale='zh_TW') }} and {{ reservation.end_dt | format_time(locale='zh_TW') }}.
  423. {%- endif %}
  424. Reason: {{ reservation.booking_reason }}
  425. {%- endblock -%}
  426. @@ -29,3 +30,5 @@ be instantly notified by e-mail.
  427.  
  428. {%- block prebooking_warning %}{% endblock %}
  429. {%- endblock %}
  430. +
  431. +<!-- Franklin.20191214 -->
  432. diff --git a/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_manager.txt b/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_manager.txt
  433. index d116f1567e..92d6531841 100644
  434. --- a/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_manager.txt
  435. +++ b/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_manager.txt
  436. @@ -1,5 +1,5 @@
  437. {% extends 'rb/emails/reservations/base_email_to_manager.txt' %}
  438.  
  439. {% block body -%}
  440. -The date {{ reservation.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }} from a booking that concerns one of your rooms has been CANCELLED by the user.
  441. +The date {{ reservation.start_dt | format_date('yyyy/MM/dd ?EEEE?', locale='zh_TW') }} from a booking that concerns one of your rooms has been CANCELLED by the user.
  442. {%- endblock %}
  443. diff --git a/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_user.txt b/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_user.txt
  444. index 8032b1e4eb..4417f00b3d 100644
  445. --- a/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_user.txt
  446. +++ b/indico/modules/rb/templates/emails/reservations/occurrence_cancellation_email_to_user.txt
  447. @@ -1,7 +1,7 @@
  448. {% extends 'rb/emails/reservations/base_email_to_user.txt' %}
  449.  
  450. {% block body -%}
  451. -You have CANCELLED an occurrence of your booking on {{ occurrence.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }}.
  452. +You have CANCELLED an occurrence of your booking on {{ occurrence.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }}.
  453.  
  454. {% include 'rb/emails/reservations/reservation_info.txt' %}
  455. {%- endblock %}
  456. diff --git a/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_manager.txt b/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_manager.txt
  457. index 60f3d51068..be7554ef68 100644
  458. --- a/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_manager.txt
  459. +++ b/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_manager.txt
  460. @@ -1,7 +1,7 @@
  461. {% extends 'rb/emails/reservations/base_email_to_manager.txt' %}
  462.  
  463. {% block body -%}
  464. -A booking has been REJECTED by the manager of the room '{{ reservation.room.full_name }}' for the {{ occurrence.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }}.
  465. +A booking has been REJECTED by the manager of the room '{{ reservation.room.full_name }}' for the {{ occurrence.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }}.
  466.  
  467. Rejection reason:
  468. {{ occurrence.rejection_reason }}
  469. diff --git a/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_user.txt b/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_user.txt
  470. index 5b8bf60be6..8c21884c87 100644
  471. --- a/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_user.txt
  472. +++ b/indico/modules/rb/templates/emails/reservations/occurrence_rejection_email_to_user.txt
  473. @@ -1,7 +1,7 @@
  474. {% extends 'rb/emails/reservations/base_email_to_user.txt' %}
  475.  
  476. {% block body -%}
  477. -Your booking has been REJECTED by the manager of the room for the {{ occurrence.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }}.
  478. +Your booking has been REJECTED by the manager of the room for the {{ occurrence.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }}.
  479.  
  480. Rejection reason:
  481. {{ occurrence.rejection_reason }}
  482. diff --git a/indico/modules/rb/templates/emails/reservations/reminders/finishing_bookings.html b/indico/modules/rb/templates/emails/reservations/reminders/finishing_bookings.html
  483. index b56e07c702..da025c3b09 100644
  484. --- a/indico/modules/rb/templates/emails/reservations/reminders/finishing_bookings.html
  485. +++ b/indico/modules/rb/templates/emails/reservations/reminders/finishing_bookings.html
  486. @@ -29,7 +29,8 @@
  487.  
  488.  
  489. {% macro _render_dates(reservation) -%}
  490. - <strong>{{ reservation.start_dt|format_datetime('EEEE dd/MM/yyyy HH:mm', locale='en_GB') }}</strong> - <strong>{{ reservation.end_dt|format_datetime('EEEE dd/MM/yyyy HH:mm', locale='en_GB') }}</strong>
  491. + <!-- Franklin.20191214 -->
  492. + <strong>{{ reservation.start_dt|format_datetime('yyyy/MM/dd (EEEE) HH:mm', locale='zh_TW') }}</strong> - <strong>{{ reservation.end_dt|format_datetime('yyyy/MM/dd (EEEE) HH:mm', locale='zh_TW') }}</strong>
  493. {%- endmacro %}
  494.  
  495.  
  496. diff --git a/indico/modules/rb/templates/emails/reservations/reminders/upcoming_occurrence.html b/indico/modules/rb/templates/emails/reservations/reminders/upcoming_occurrence.html
  497. index 6a80ae4e26..85d397d9d3 100644
  498. --- a/indico/modules/rb/templates/emails/reservations/reminders/upcoming_occurrence.html
  499. +++ b/indico/modules/rb/templates/emails/reservations/reminders/upcoming_occurrence.html
  500. @@ -29,7 +29,8 @@
  501. {% macro _render_occurrence(occurrence) -%}
  502. {% set reservation = occurrence.reservation -%}
  503.  
  504. - <strong>{{ occurrence.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }}</strong> (<strong>{{ _render_time(occurrence) }}</strong>)<br>
  505. + <!-- Franklin.20191214 -->
  506. + <strong>{{ occurrence.start_dt | format_date('yyyy/MM/dd (EEEE)', locale='zh_TW') }}</strong> (<strong>{{ _render_time(occurrence) }}</strong>)<br>
  507. Room: <strong>{{ reservation.room.full_name }}</strong><br>
  508. Reason: <strong>{{ reservation.booking_reason }}</strong><br>
  509. <br>
  510. diff --git a/indico/modules/rb/templates/emails/reservations/reservation_info.txt b/indico/modules/rb/templates/emails/reservations/reservation_info.txt
  511. index dad3a0bb2e..518fc02c68 100644
  512. --- a/indico/modules/rb/templates/emails/reservations/reservation_info.txt
  513. +++ b/indico/modules/rb/templates/emails/reservations/reservation_info.txt
  514. @@ -1,5 +1,5 @@
  515. Room: {{ reservation.room.full_name }}
  516. For: {{ reservation.booked_for_name }}
  517. Reason: {{ reservation.booking_reason }}
  518. -Dates: {{ reservation.start_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }} - {{ reservation.end_dt | format_date('EEEE dd/MM/yyyy', locale='en_GB') }}
  519. -Hours: {{ reservation.start_dt | format_time(locale='en_GB') }} - {{ reservation.end_dt | format_time(locale='en_GB') }}
  520. +Dates: {{ reservation.start_dt | format_date('yyyy/MM/dd?EEEE?', locale='zh_TW') }} - {{ reservation.end_dt | format_date('yyyy/MM/dd (EEEE)', locale='zh_TW') }}
  521. +Hours: {{ reservation.start_dt | format_time(locale='zh_TW') }} - {{ reservation.end_dt | format_time(locale='zh_TW') }}
  522. diff --git a/indico/util/date_time.py b/indico/util/date_time.py
  523. index 14e0205797..d1866d3d06 100644
  524. --- a/indico/util/date_time.py
  525. +++ b/indico/util/date_time.py
  526. @@ -98,7 +98,9 @@ def format_datetime(dt, format='medium', locale=None, timezone=None, as_unicode=
  527. """
  528. inject_unicode = True
  529. if format == 'code':
  530. - format = 'dd/MM/yyyy HH:mm'
  531. + # Franklin.20191214
  532. + #format = 'dd/MM/yyyy HH:mm'
  533. + format = 'yyyy/MM/dd HH:mm'
  534. inject_unicode = False
  535. if not locale:
  536. locale = get_current_locale()
  537. @@ -117,7 +119,9 @@ def format_date(d, format='medium', locale=None, timezone=None, as_unicode=False
  538. """
  539. inject_unicode = True
  540. if format == 'code':
  541. - format = 'dd/MM/yyyy'
  542. + # Franklin.20191214
  543. + #format = 'dd/MM/yyyy'
  544. + format = 'yyyy/MM/dd'
  545. inject_unicode = False
  546. if not locale:
  547. locale = get_current_locale()
  548. diff --git a/indico/web/client/js/jquery/utils/defaults.js b/indico/web/client/js/jquery/utils/defaults.js
  549. index 7f84eab97a..c6879cfe43 100644
  550. --- a/indico/web/client/js/jquery/utils/defaults.js
  551. +++ b/indico/web/client/js/jquery/utils/defaults.js
  552. @@ -14,7 +14,9 @@ import {$T} from '../../utils/i18n';
  553. $.datepicker.setDefaults({
  554. autoSize: true,
  555. buttonText: '',
  556. - dateFormat: 'dd/mm/yy',
  557. +// Franklin.20191211
  558. +// dateFormat: 'dd/mm/yy',
  559. + dateFormat: 'yy/mm/dd',
  560. firstDay: 1,
  561. nextText: $T('Next'),
  562. prevText: $T('Previous'),
  563. @@ -23,7 +25,9 @@ $.datepicker.setDefaults({
  564.  
  565. $.extend(true, $.indico.daterange.prototype.options, {
  566. pickerOptions: {
  567. - dateFormat: 'dd/mm/yy',
  568. +// Franklin.20191211
  569. +// dateFormat: 'dd/mm/yy',
  570. + dateFormat: 'yy/mm/dd',
  571. },
  572. labelAttrs: {
  573. class: 'label titleCellFormat',
  574. diff --git a/indico/web/client/js/jquery/widgets/jinja/datetime_widget.js b/indico/web/client/js/jquery/widgets/jinja/datetime_widget.js
  575. index 211ba2653b..88c4bddf73 100644
  576. --- a/indico/web/client/js/jquery/widgets/jinja/datetime_widget.js
  577. +++ b/indico/web/client/js/jquery/widgets/jinja/datetime_widget.js
  578. @@ -160,7 +160,9 @@
  579. .push(updateMinTime);
  580. timeField.data('onChangeHandlers').push(function() {
  581. var selectedDate = moment(dateField.datepicker('getDate'));
  582. - updateMinTime(selectedDate.format('DD/MM/YYYY'));
  583. + // Franklin.20191214
  584. + //updateMinTime(selectedDate.format('DD/MM/YYYY'));
  585. + updateMinTime(selectedDate.format('YYYY/MM/DD'));
  586. });
  587. if (initialDate) {
  588. updateMinTime(initialDate);
  589. @@ -175,7 +177,9 @@
  590. .push(updateMaxTime);
  591. timeField.data('onChangeHandlers').push(function() {
  592. var selectedDate = moment(dateField.datepicker('getDate'));
  593. - updateMaxTime(selectedDate.format('DD/MM/YYYY'));
  594. + // Franklin.20191214
  595. + //updateMaxTime(selectedDate.format('DD/MM/YYYY'));
  596. + updateMaxTime(selectedDate.format('YYYY/MM/DD'));
  597. });
  598. if (initialDate) {
  599. updateMaxTime(initialDate);
  600. diff --git a/indico/web/client/js/legacy/libs/indico/Core/Data.js b/indico/web/client/js/legacy/libs/indico/Core/Data.js
  601. index 133a468f05..a234646cd5 100644
  602. --- a/indico/web/client/js/legacy/libs/indico/Core/Data.js
  603. +++ b/indico/web/client/js/legacy/libs/indico/Core/Data.js
  604. @@ -49,7 +49,9 @@ var Util = {
  605. considering formats (sourceFormat used for strings only) */
  606. formatDateTime: function(obj, format, sourceFormat) {
  607. // default value
  608. - format = format || '%d/%m/%Y %H:%M';
  609. + // Franklin.20191214
  610. + //format = format || '%d/%m/%Y %H:%M';
  611. + format = format || '%Y/%m/%d %H:%M';
  612.  
  613. var m1 = null,
  614. m2 = null;
  615. @@ -206,7 +208,9 @@ Util.Validation = {
  616. };
  617.  
  618. var IndicoDateTimeFormats = {
  619. - International: '%d/%m/%Y %H:%M',
  620. + //Franklin.20191214
  621. + //International: '%d/%m/%Y %H:%M',
  622. + International: '%Y/%m/%d %H:%M',
  623. ISO8601: '%Y/%m/%d %H:%M',
  624. Ordinal: '%Y%m%d',
  625. };
  626. diff --git a/indico/web/client/js/legacy/libs/timetable/Base.js b/indico/web/client/js/legacy/libs/timetable/Base.js
  627. index 64fe6baed6..295cb1cd2b 100644
  628. --- a/indico/web/client/js/legacy/libs/timetable/Base.js
  629. +++ b/indico/web/client/js/legacy/libs/timetable/Base.js
  630. @@ -485,7 +485,7 @@ type(
  631. var delements = parseDate(strDate);
  632. var nDate = new Date(delements[2], delements[1] - 1, delements[0]);
  633.  
  634. - return Indico.Data.WeekDays[nDate.getDay()].substring(0, 3) + ' ' + day + '/' + month;
  635. + return Indico.Data.WeekDays[nDate.getDay()].substring(0, 3) + ' ' + month + '/' + day;
  636. },
  637.  
  638. _parseDayInterval: function(hash) {
  639. diff --git a/indico/web/forms/fields/datetime.py b/indico/web/forms/fields/datetime.py
  640. index 4c8aae5b62..4f1fe630fd 100644
  641. --- a/indico/web/forms/fields/datetime.py
  642. +++ b/indico/web/forms/fields/datetime.py
  643. @@ -179,8 +179,11 @@ class IndicoDateField(DateField):
  644. widget = JinjaWidget('forms/date_widget.html', single_line=True, single_kwargs=True)
  645.  
  646. def __init__(self, *args, **kwargs):
  647. +# Franklin.20191214
  648. +# super(IndicoDateField, self).__init__(*args, parse_kwargs={'dayfirst': True},
  649. +# display_format='%d/%m/%Y', **kwargs)
  650. super(IndicoDateField, self).__init__(*args, parse_kwargs={'dayfirst': True},
  651. - display_format='%d/%m/%Y', **kwargs)
  652. + display_format='%Y/%m/%d', **kwargs)
  653.  
  654.  
  655. class IndicoDateTimeField(DateTimeField):
  656. diff --git a/indico/web/templates/forms/date_widget.html b/indico/web/templates/forms/date_widget.html
  657. index 03231b45be..76558a961f 100644
  658. --- a/indico/web/templates/forms/date_widget.html
  659. +++ b/indico/web/templates/forms/date_widget.html
  660. @@ -1,8 +1,9 @@
  661. {% extends 'forms/base_widget.html' %}
  662.  
  663. +<!-- Franklin.20191214 change placeholder from DD/MM/YYYY to YYYY/MM/DD -->
  664. {% block html %}
  665. <input type="text" id="{{ field.id }}" value="{{ field._value() }}" name="{{ field.name }}"
  666. - placeholder="DD/MM/YYYY" {{ input_args | html_params }}>
  667. + placeholder="YYYY/MM/DD" {{ input_args | html_params }}>
  668. {% endblock %}
  669.  
  670. {% block javascript %}
  671. diff --git a/indico/web/templates/forms/datetime_widget.html b/indico/web/templates/forms/datetime_widget.html
  672. index f4093f9d8a..17c713e0e4 100644
  673. --- a/indico/web/templates/forms/datetime_widget.html
  674. +++ b/indico/web/templates/forms/datetime_widget.html
  675. @@ -4,7 +4,8 @@
  676. {% block html %}
  677. <div class="datetime-widget i-form-field-fixed-width">
  678. <input type="hidden" autofocus>
  679. - <input type="text" name="{{ field.name }}" id="{{ field.id }}-date" class="datepicker" placeholder="DD/MM/YYYY"
  680. + <!-- Franklin.20191214: change placeholder from DD/MM/YYYY to YYYY/MM/DD -->
  681. + <input type="text" name="{{ field.name }}" id="{{ field.id }}-date" class="datepicker" placeholder="YYYY/MM/DD"
  682. {% if field.data and not field.date_missing %}value="{{ field.data | format_date('code', timezone=field.timezone) }}"{% endif %}
  683. {% if required %}required{% endif %}
  684. {% if disabled %}disabled{% endif %}>{#--#}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement