Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: samples/chat/dart_client/chat.dart

Issue 11770004: Rename Date to DateTime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and keep Backwards-compatibility class Date. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | samples/clock/web/balls.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library chat; 5 library chat;
6 import 'dart:html'; 6 import 'dart:html';
7 import 'dart:json' as jsonlib; 7 import 'dart:json' as jsonlib;
8 8
9 void main() { 9 void main() {
10 new Chat().start(); 10 new Chat().start();
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 text.add("timeout"); 226 text.add("timeout");
227 } 227 }
228 p.text = text.toString(); 228 p.text = text.toString();
229 _messages.insertAdjacentElement('afterBegin', p); 229 _messages.insertAdjacentElement('afterBegin', p);
230 if (_messages.children.length > 20) { 230 if (_messages.children.length > 20) {
231 _messages.children.removeLast(); 231 _messages.children.removeLast();
232 } 232 }
233 } 233 }
234 234
235 String formatMessageTime(String received) { 235 String formatMessageTime(String received) {
236 Date date = new Date.fromString(received); 236 DateTime date = new DateTime.fromString(received);
237 StringBuffer formattedTime = new StringBuffer(); 237 StringBuffer formattedTime = new StringBuffer();
238 if (date.hour < 10) formattedTime.add("0"); 238 if (date.hour < 10) formattedTime.add("0");
239 formattedTime.add(date.hour); 239 formattedTime.add(date.hour);
240 formattedTime.add(":"); 240 formattedTime.add(":");
241 if (date.minute < 10) formattedTime.add("0"); 241 if (date.minute < 10) formattedTime.add("0");
242 formattedTime.add(date.minute); 242 formattedTime.add(date.minute);
243 formattedTime.add(":"); 243 formattedTime.add(":");
244 if (date.second < 10) formattedTime.add("0"); 244 if (date.second < 10) formattedTime.add("0");
245 formattedTime.add(date.second); 245 formattedTime.add(date.second);
246 return formattedTime.toString(); 246 return formattedTime.toString();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 Element _chatSection; 306 Element _chatSection;
307 InputElement _messageInput; 307 InputElement _messageInput;
308 Element _messages; 308 Element _messages;
309 Element _statusText; 309 Element _statusText;
310 310
311 String _session = null; 311 String _session = null;
312 int _nextMessage = 0; 312 int _nextMessage = 0;
313 HttpRequest _pollRequest = null; 313 HttpRequest _pollRequest = null;
314 314
315 } 315 }
OLDNEW
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | samples/clock/web/balls.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698