Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 var d = new Date(when); | 97 var d = new Date(when); |
98 var timeString = d.toLocaleTimeString(); | 98 var timeString = d.toLocaleTimeString(); |
99 | 99 |
100 var now = new Date(); | 100 var now = new Date(); |
101 if (d.toDateString() == now.toDateString()) | 101 if (d.toDateString() == now.toDateString()) |
102 return [timeString]; | 102 return [timeString]; |
103 else | 103 else |
104 return [timeString, d.toLocaleDateString()]; | 104 return [timeString, d.toLocaleDateString()]; |
105 } | 105 } |
106 | 106 |
107 // Formats date string to ["yyyy-mm-dd", "mm:ss"] format | 107 // Formats date string to ["YYYY-MM-DD", "mm:ss"] format |
Thomas Greiner
2016/02/01 18:52:35
Detail: Usually, you would write it as "YYYY-MM-DD
saroyanm
2016/02/03 14:04:25
Done.
| |
108 function i18n_formatDateTime(when) | 108 function i18n_formatDateTime(when) |
109 { | 109 { |
110 var date = new Date(when); | 110 var date = new Date(when); |
111 var dateParts = [date.getFullYear(), date.getMonth() + 1, date.getDate(), | 111 var dateParts = [date.getFullYear(), date.getMonth() + 1, date.getDate(), |
112 date.getHours(), date.getMinutes()]; | 112 date.getHours(), date.getMinutes()]; |
113 | 113 |
114 var dateParts = dateParts.map(function(datePart) | 114 var dateParts = dateParts.map(function(datePart) |
115 { | 115 { |
116 return datePart < 10 ? "0" + datePart : datePart; | 116 return datePart < 10 ? "0" + datePart : datePart; |
117 }); | 117 }); |
118 | 118 |
119 return [dateParts.splice(0, 3).join("-"), dateParts.join(":")]; | 119 return [dateParts.splice(0, 3).join("-"), dateParts.join(":")]; |
120 } | 120 } |
121 | 121 |
122 // Fill in the strings as soon as possible | 122 // Fill in the strings as soon as possible |
123 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); | 123 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); |
LEFT | RIGHT |